As Cor mentioned, you could use some of the samples in the Remoting
infrastructure, although multithreading and asynchronous programming don't
have to involve remoting - remoting is more or less the .net version of
DCOM.
Here's some links that may help you out with threads and asynchronous
programming.
http://msdn.microsoft.com/library/d...n-us/vbcn7/html/vaconFreeThreadingExample.asp
http://msdn.microsoft.com/msdnmag/issues/01/07/vbnet/default.aspx
http://msdn.microsoft.com/library/d...dowsformsmultithreadedtciiplistenersample.asp
I suggest you also look up topics relating to the "thread pool" and
asynchronous delegates.
Here's a quick example on how to call a method asynchronously in VB.net with
one parameter (there are more ways to do this, but this is just a simple
example)
-------------------------
' Delegate to call async
Private Delegate Sub DoStuffDelegate(Byval MyParam as String)
' Main Entry point
Private Sub Main()
' Local Variables
Dim DoStuffAsync as new DoStuffDelegate(AddressOf Me.DoStuff)
Dim objResult as IAsyncResult
' Start the async processing
objResult = DoStuffAsync.BeginInvoke(nothing, nothing)
' Do some stuff in this thread
Threading.Thread.Sleep(5000)
' Pause until the processing has finished
DoStuffAsync.EndInvoke(objResult)
End Sub
' Method that runs on a different thread
Private Sub DoStuff()
' Do stuff on a different thread
Threading.Thread.Sleep(10000)
End Sub
-------------------------
HTH,
Trev.
... said:
Does anyone know a good tutorial on asynchronous programming in .net?
AsyncCallback And IASyncResult are driving me crazy. And the msdn
documentation is not really helpful on this topic.