Look into the System.Threading.Thread class and the System.Threading namespace to run code in parallel.
.Net 3.5 and up also have something called a TaskFactory, which handles a lot of the overhead and complications that can arise when making multithreaded apps. I typically do all the threading myself, but my cooworkers swears by the TaskFactory.
Keep in mind that if you access something on one thread at the same time as on a different thread you will have big problems (cross threading violations, race conditions, and other unexpected results).
Here's a simple example of a multithreaded app using System.Threading.Thread.
volatile bool bKillThread = false;
delegate void myCallBackDelegate();
void StartNewThread()
{
Thread t = new Thread(new ThreadStart(myParallelMethod))
t.Start();
//Stuff here will run in parallel with the thread we just started
}
void myParallelMethod()
{
while (!bKillThread)
{
CallbacktoMainThread();
Thread.Sleep(500); //Pause for 500 ms to avoid overloading cpu
}
}
void CallbacktoMainThread()
{
//thread safe checking
if (InvokeRequired) Then
Invoke(new myCallBackDelegate(CallbacktoMainThread))
else
DoSomething();
}