i can not find a way in order to change a label while this tread is running
if i do this
I get the error that Cross-thread operation not valid: Control 'label' accessed from a thread other than the thread it was created on. who can i solve this?
Code:
public void work()
{
///////
int[] d = new int[5];
Thread.Sleep(draw_delay);
for (int i = 0; i < 5; i++)
{
d[i] = 0;
double a;
a = Math.Sqrt(Math.Pow(pointcheck[0] - X[i], 2) + Math.Pow(pointcheck[1] - Y[i], 2));
d[i] = Convert.ToInt32(a);
}
myTempMap = ptuxiaki.Properties.Resources.map;
if (Math.Abs(d[0]) < R[0])
{
UpdateWiMax_enable();// This method will draw an ellipse for the WiMax signal
}
else {
UpdateWiMax();
}
if (Math.Abs(d[1]) < R[1])
{
UpdateUMTS_enable();// you get the drift
}
else
{
UpdateUMTS();
}
if (Math.Abs(d[2]) < R[2])
{
UpdateCPC_enable();
}
else
{
UpdateCPC();
}
if (Math.Abs(d[3]) < R[3])
{
UpdateGPRS_enable();
}
else
{
UpdateGPRS();
}
if (Math.Abs(d[4]) < R[4])
{
UpdateWiFi_enable();
}
else
{
UpdateWiFi();
}
pictureBox_Map.Image = myTempMap;
myTempMap = null;
}
Code:
if (Math.Abs(d[0]) < R[0])
{
UpdateWiMax_enable();
label.text="something";
}
Comment