Пример #1
0
 private void setText(string text, Label lbl)
 {
     if (lbl.InvokeRequired)
     {
         setTextCallBack d = new setTextCallBack(setText);
         this.Invoke(d, new object[] { text, lbl });
     }
     else
     {
         lbl.Text = text;
     }
 }
Пример #2
0
 //method for outside thread to write in text field
 public void addText(string input)
 {
     if (this.richTextBox1.InvokeRequired)
     {
         setTextCallBack d = new setTextCallBack(addText);
         this.Invoke(d, new object[] { input });
     }
     else
     {
         richTextBox1.Text += input + "\n";
         richTextBox1.SelectionStart = richTextBox1.Text.Length;
         richTextBox1.ScrollToCaret();
     }
 }