Hey guys,
I've got a multithreaded application. The GUI runs on its own thread whilst a background worker thread will get invovked later on. Now the problem occurs when the bakground thread trys to manipulate the GUI thread.
Solution is a callback using invokeRequired.
public void ThreadProcSafe2(String text)
{
if (this.m_AllKnownDevicesFrm.InvokeRequired)
{
// It's on a different thread, so use Invoke.
SetTextCallback3 d = new SetTextCallback3(switchPanels);
this.Invoke(d, new object[] {1} );
}
else
{
switchPanels(1);
}
}
But this fails when its running... With error of
"invalid parameter"
switchPanels is a method declared to take an int has an agrument.
Confused. Can anyone shread any light onto this problem?
Thanks guys...