B
Bob Day
Using VS 2003, VB.net , MSDE ....
I am confused by the help example below. In a sub main (whether in a module
or winform), do you have to explicitly start the Main_Thread, as they do in
this example? If the answer is not always, when and where would you and for
what reasons? I don't explicitly start the thread (although I give it a
name) in a module Sub Main, and it still lists the thread as being created
in the threads window.
Thanks!
Bob
Setting a Thread Name (Managed)
Public Class Form1 : Inherits Form
Class Needle
' This method will be called when the thread is started
Sub Baz()
Console.WriteLine("Needle Baz is running on another thread")
End Sub
End Class
Public Shared Sub Main()
Console.WriteLine("Thread Simple Sample")
Dim oNeedle As New Needle()
' Create a Thread object
Dim oThread As New Thread(AddressOf oNeedle.Baz)
' Set the Thread name to "MainThread"
oThread.Name = "MainThread"
' Starting the thread invokes the ThreadStart delegate
oThread.Start()
End Sub
End Class
I am confused by the help example below. In a sub main (whether in a module
or winform), do you have to explicitly start the Main_Thread, as they do in
this example? If the answer is not always, when and where would you and for
what reasons? I don't explicitly start the thread (although I give it a
name) in a module Sub Main, and it still lists the thread as being created
in the threads window.
Thanks!
Bob
Setting a Thread Name (Managed)
Public Class Form1 : Inherits Form
Class Needle
' This method will be called when the thread is started
Sub Baz()
Console.WriteLine("Needle Baz is running on another thread")
End Sub
End Class
Public Shared Sub Main()
Console.WriteLine("Thread Simple Sample")
Dim oNeedle As New Needle()
' Create a Thread object
Dim oThread As New Thread(AddressOf oNeedle.Baz)
' Set the Thread name to "MainThread"
oThread.Name = "MainThread"
' Starting the thread invokes the ThreadStart delegate
oThread.Start()
End Sub
End Class