I get the following error with this code below this text.
Message=Cross-thread operation not valid: Control 'richTextBox1' accessed from a thread other than the thread it was created on.
Can someone help me?
HTML Code:
private void OnTimeEvent(object sender, System.Timers.ElapsedEventArgs e)
{
if (saved == true)
{
saved = false;
richTextBoxInfo.Invoke((MethodInvoker)(() => richTextBoxInfo.Text = richTextBoxInfo.Text));
File.WriteAllText(@"wininfo.txt", richTextBoxInfo.Text);
timerSave.Stop();
MessageBox.Show("Saved!");
}
}