When creating new Thread
,how to pass a method which have TextBoxes
as parameters??
private void waits(TextBox t1 ,TextBox t2)
{
t1.BackColor = Color.Red;
t2.BackColor = Color.Red;
}
Thread n1=new Thread(waits)
When creating new Thread
,how to pass a method which have TextBoxes
as parameters??
private void waits(TextBox t1 ,TextBox t2)
{
t1.BackColor = Color.Red;
t2.BackColor = Color.Red;
}
Thread n1=new Thread(waits)
Use Invoke
private void waits(TextBox t1 ,TextBox t2)
{
t1.Invoke(new Action(()=>
{
t1.BackColor = Color.Red;
});
t2.Invoke(new Action(()=>
t2.BackColor = Color.Red;
});
}