Hello Why I haven't access to my private control on form (e.g. ListBox) from a static method? How to update control in this case?
EDIT 1.
my code:
ThreadStart thrSt = new ThreadStart(GetConnected);
Thread thr = new Thread(thrSt);
thr.Start();
and
static void GetConnected()
{
//update my ListBox
}
So it must be void, without param and be static, right?
EDIT 2.
If someone need solution in WPF then should try this:
private void GetConnected()
{
myListBox.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal,
new Action(() =>
{
myListBox.Items.Add("something");
}
)
);
}