Help with ThreadPool parameter?

  • Thread starter Thread starter Brett Romero
  • Start date Start date
B

Brett Romero

I'd like to use

ThreadPool.QueueUserWorkItem( new WaitCallback( flashRowColor(dgv) ) );

in a couple of places.

I have a method the callback should use:

private void flashRowColor( object pDataGridView ){...}

I've tried several combinations of using delegate keyword, parameters
for WaitCallback() but nothing seems to work for this scenario. I'm
currently using ParameterizedThreadStart(), which works fine.

But now I want to know how to get QueueUserWorkItem working. If
QueueUserWorkItem will work somehow, can I type the "object" parameter
on WaitCallback() as DataGridView to avoid casting the target?

Thanks,
Brett
 
ThreadPool.QueueUserWorkItem( new WaitCallback( flashRowColor(dgv) ) );

Try

ThreadPool.QueueUserWorkItem(new WaitCallback(flashRowColor), dgv);


Mattias
 
Back
Top