I'm trying to do this:
string Proxy = listBox3.SelectedIndex.ToString();
pretty simple right?
But in cross threading I get this error:
Cross-thread operation not valid: Control 'listBox3' accessed from a thread other than the thread it was created on.
So I googled it and found this:
this.Invoke((MethodInvoker)(() => listBox3.Items.Add(Item2add)));
and tried it with this thinking it would work:
string Proxy = listBox3.Invoke((MethodInvoker)(() => listBox3.SelectedIndex.ToString()));
but I got this error:
Additional information: Object reference not set to an instance of an object.