Home All Groups Group Topic Archive Search About
Author
29 Mar 2005 12:56 AM
Federico G. Babelis
Hi All:

Im new to the threading programming, and i have problem working with threads
in my VB.NET application. I have a module.vb with the following thread
definition in the declarations:

Public Thread_Test As New System.Threading.Thread(AddressOf
MDIChild.SomeFunction)

The problem resides after the thread had been terminated, how can i start a
new thread for the same function ?, also the fuction should be able to call
Thread_Test.start(); Thread_Test.Suspend() and Thread_Test.resume() from any
function in the program.

Any idea ?

Thanks,
Federico

Author
29 Mar 2005 4:10 AM
MeltingPoint
Show quote Hide quote
"Federico G. Babelis" <feder***@gazum.com> wrote in
news:#GiBao$MFHA.2468@tk2msftngp13.phx.gbl:

> Hi All:
>
> Im new to the threading programming, and i have problem working with
> threads in my VB.NET application. I have a module.vb with the
> following thread definition in the declarations:
>
> Public Thread_Test As New System.Threading.Thread(AddressOf
> MDIChild.SomeFunction)
>
> The problem resides after the thread had been terminated, how can i
> start a new thread for the same function ?, also the fuction should be
> able to call Thread_Test.start(); Thread_Test.Suspend() and
> Thread_Test.resume() from any function in the program.
>
> Any idea ?
>
> Thanks,
> Federico
>
>
>

I may be wrong here, but if Thread_Test is defined at the *module* level
then you should just be able to call Thread_Test.Start anytime any where
inside that module. If it's out side the module *I THINK* Thread_Test
needs to be declared as "Public Shared Thread_Test As New
System.Threading.Thread(AddressOf MDIChild.SomeFunction)" and referenced
as Module1.Thread_Test.Start()

Also I believe the SomeFunction should be SomeSub (can't use functions)
as well, and that Sub will also have to be declared as "Shared" then you
should be good to go.

MP