Hi,
I'm trying to get a seperate class, initialized by a form class, to
manipulate certain objects on the form (ex: add to a listbox). The
manipulation will occur via a thread that is not the normal WinForm GUI
thread. How would I go about doing this?
I have this code for cross-thread WinForm manipulation, but only from within
the WinForm class:
public delegate void LogDelegate(str ing txt);
public void Log(string txt)
{
if (InvokeRequired )
{
Invoke(new LogDelegate(Log ), txt);
return;
}
lstLog.Items.In sert(0, DateTime.Now.To String("T") + " - " + txt);
}
Thanks,
Ian
I'm trying to get a seperate class, initialized by a form class, to
manipulate certain objects on the form (ex: add to a listbox). The
manipulation will occur via a thread that is not the normal WinForm GUI
thread. How would I go about doing this?
I have this code for cross-thread WinForm manipulation, but only from within
the WinForm class:
public delegate void LogDelegate(str ing txt);
public void Log(string txt)
{
if (InvokeRequired )
{
Invoke(new LogDelegate(Log ), txt);
return;
}
lstLog.Items.In sert(0, DateTime.Now.To String("T") + " - " + txt);
}
Thanks,
Ian
Comment