What i want to do is that when i click buttonX4 i want the text to change from "Copy To Clipboard" to "Your Bio Has Been Copied" Then i want it to wait for 2 seconds then i want it to change back to "Copy To Clipboard". I did this with the assist of a timer. It all works until it goes to
public void OnTimedEvent(object source, ElapsedEventArgs e)
{
buttonX4.Text = "Copy To Clipboard";
}
after this this message comes up : "Cross-thread operation not valid: Control 'buttonX4' accessed from a thread other than the thread it was created on."
How can i fix it ?
MY CODE
public void buttonX4_Click(object sender, EventArgs e)
{
buttonX4.Text = "Your Bio Has Been Copied";
timer1.Start();
}
private void timer1_Tick(object sender, EventArgs e)
{
l_time = new System.Timers.Timer(2000);
l_time.AutoReset = false;
l_time.Start();
l_time.Elapsed += new ElapsedEventHandler(OnTimedEvent);
}
public void OnTimedEvent(object source, ElapsedEventArgs e)
{
buttonX4.Text = "Copy To Clipboard";
}