As a VB.Net newbie (having only experience with VBScript), I'm struggling
to pass parameters to threads. Although the online help gives examples, I
can't get my head around the idea of delegates etc. While I've purchased a
book to help me get to grips with classes etc, I really need a solution to
this particular problem as soon as, and would be very grateful if someone
could take a few minutes to help.
The code below is from a console application. Instead of defining the
console output in the thread (in this case "Console Text"), I'd like to
pass a string to the thread so that multiple threads could output different
text.
Thanks in advance.
Bryan
THE CODE:
----------------------------------
Imports System
Imports System.Threading
Module Module1
Sub Main()
Dim MyThread As New Thread(AddressOf ThreadCode)
MyThread.Start()
End Sub
Sub ThreadCode()
Dim intLoopCounter As Integer
For intLoopCounter = 1 To 1000
Console.WriteLine("Console Text")
Next
End Sub
End Module
You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.