Multithreading joins

pedders

Member
Joined
May 4, 2007
Messages
6
Programming Experience
Beginner
I have a program with a data entry form.

Upon pressing a button it calls on a module which takes the data from the form and inserts it into a file and saves them. (ModulePC.Output)

After doing that it then takes the files and prints them via MS Word (dim appword as new Word.Application) (ModulePC.Print)

After these two events a dialog appears with inputs for updating a logfile.

While it is doing the output and printing events the interface of the app freezes until they are done.

So i tries multithreading.

Dim t1 As Thread = New Thread(AddressOf ModulePC.zonesoutput)
Dim t2 As Thread = New Thread(AddressOf ModulePC.printzones)
t1.Start()
t2.Start()
Try
t1.Join()
t2.Join()
Catch err As Exception
MsgBox(err.Message, MsgBoxStyle.OkOnly)
Finally
'Do Nothing
End Try

Even if i just have 1 thread and start it when it comes to running the app it does nothing, i do it step by step and it goes straight past the above but doesn't actually do anything.

I would like it so that it outputs and prints in the background while i fill in the details on the dialog for the logfile rather than being forced to wait.

Failing that a progress bar that updates as it does each step.

This surely is possible and reasonably easy for a novice like me.

Thanks in advance

Pedders
 
Thread.Join blocks the thread it is called on until the other thread is finished, not a good idea to on a UI thread.
 
Back
Top