I put together a little demo that shows how to do simple multithreaded code in VB.NET. Rather than bury a simple demo with synchronization to the nines, I'll tell you to just accept this as an learning sample of how to use the thread pool and how to kick off a new OS thread. It does not imply any best practices. You should synchronize your multithreaded code as appropriate. This sample is just meant to show people the basic mechanics of multithreading with VB.NET. Thought it was interesting, so I decided to put it up here.

Also, the MessageBoxes are simply in place to give me a cheap block on a thread. Uncomment the message box in DoFileSearch to see it. In production code, you should not touch UI from a worker thread. Rather, use a WinForm's Invoke method to push the work request back onto the UI thread that created it. You'll see an example of this in the code...

Also, the program searches for a file in a directory. obviously, you'll want to choose a file and directory that are actually on your machine ;-)

http://www.aggelos.com/demos/Threading-VBDemo.zip

This posting is provided "AS IS" with no warranties, and confers no rights.