J
joey.powell
I am using VS2005 for a windows forms application. I need to be able to
use a worker thread function to offload some processing from the UI
thread. The worker thread will need access to a datagridview on the
form. I am using the following code to spawn the worker thread...
Thread WorkerThread = new Thread(new ThreadStart(WT_MyFunction));
WorkerThread.IsBackground = true;
WorkerThread.Start();
The problem I am having is...I cannot seem to figure out how to pass
objects into the worker thread function. For example, when I try to
use the following code...
Thread WorkerThread = new Thread(new ThreadStart(WT_MyFunction(ref
dgvMyDataGridView)));
WorkerThread.IsBackground = true;
WorkerThread.Start();
....I get the compile time error: "Method name expected".
What am I doing wrong, and how can I make this work?
JP
use a worker thread function to offload some processing from the UI
thread. The worker thread will need access to a datagridview on the
form. I am using the following code to spawn the worker thread...
Thread WorkerThread = new Thread(new ThreadStart(WT_MyFunction));
WorkerThread.IsBackground = true;
WorkerThread.Start();
The problem I am having is...I cannot seem to figure out how to pass
objects into the worker thread function. For example, when I try to
use the following code...
Thread WorkerThread = new Thread(new ThreadStart(WT_MyFunction(ref
dgvMyDataGridView)));
WorkerThread.IsBackground = true;
WorkerThread.Start();
....I get the compile time error: "Method name expected".
What am I doing wrong, and how can I make this work?
JP