Thread doesn't have a BeginInvoke method do you mean using an Async delegate approach? e.g. (apologies for c#)
<code> using System; using System.Threading; delegate void ThreadProc(string s1, string s2 ); class Class1 { static void Main(string[] args) { ThreadProc tp = new ThreadProc(Class1.MyThreadMethod); tp.BeginInvoke( "Hello World", "Goodbye World", null, null ); Console.ReadLine(); } static void MyThreadMethod(string s1, string s2) { Console.WriteLine("string one is: {0}, string 2 is: {1}", s1, s2 ); } } </code> as this isn't quite the same thing in that you don't have direct access to the thread object running the code. In the example I gave in my previous post a parameter was passed to the thread as part of the object implementing the thread proc (see the msg member of the MyThread class). Regards Richard http://staff.develop.com/richardb -----Original Message----- From: dotnet discussion [mailto:[EMAIL PROTECTED]]On Behalf Of franklin gray Sent: 02 May 2002 17:06 To: [EMAIL PROTECTED] Subject: Re: [DOTNET] Newbie Threading Question I think his problem is passing parameters to the new thread. You pass the parms as an array of Object. I believe something like this... Dim args(2) As Object args(0) = Parm1 args(1) = Parm2 args(2) = Parm3 Thread.BeginInvoke(Delegate, args) -----Original Message----- From: Richard Blewett [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 02, 2002 9:25 AM To: [EMAIL PROTECTED] Subject: Re: [DOTNET] Newbie Threading Question Does this work for you? Module Module1 Sub Main() Dim t1 As New MyThread() Dim t2 As New MyThread() t1.msg = "Hello from T1" t2.msg = "Hello from T2" Dim thr1 As New Threading.Thread(AddressOf t1.ThreadProc) Dim thr2 As New Threading.Thread(AddressOf t2.ThreadProc) thr1.Start() thr2.Start() Console.ReadLine() End Sub End Module Class MyThread Public msg As String Public Sub ThreadProc() Console.WriteLine(msg) End Sub End Class Regards Richard http://staff.develop.com/richardb -----Original Message----- From: dotnet discussion [mailto:[EMAIL PROTECTED]]On Behalf Of Bryan Kelly Sent: 02 May 2002 15:01 To: [EMAIL PROTECTED] Subject: [DOTNET] Newbie Threading Question 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. You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.