Beispiel #1
0
 /// <summary>
 /// 스레드에서 라벨 텍스트 변경
 /// </summary>
 public static void SetTextBox(System.Windows.Forms.TextBox Textbox, string str)
 {
     if (Textbox.InvokeRequired)
     {
         SetTextBoxCallBack dele = new SetTextBoxCallBack(SetTextBox);
         Textbox.Invoke(dele, Textbox, str);
     }
     else
     {
         Textbox.AppendText(str);
     }
 }
Beispiel #2
0
 public void SetTextBox(System.Windows.Forms.TextBox textBox, string str, bool enable)
 {
     if (textBox.InvokeRequired)
     {
         SetTextBoxCallBack dele = new SetTextBoxCallBack(SetTextBox);
         textBox.Invoke(dele, textBox, str, enable);
     }
     else
     {
         textBox.Enabled = enable;
         if (str.Length > 0)
         {
             textBox.AppendText(str);
         }
     }
 }
Beispiel #3
0
 /// <param name="message"></param>
 /// <summary>
 /// Update textBoxRS232
 /// </summary>
 /// <param name="message"></param>
 private void textBoxUpdate(TextBox textboxAff, string mes)
 {
     if (textboxAff.InvokeRequired) ///InvokeRequired required compares the thread ID of the calling thread to the thread ID of the creating thread. If these threads are different, it returns true.
     {
         SetTextBoxCallBack d = new SetTextBoxCallBack(textBoxUpdate);
         Invoke(d, new object[] { textboxAff, mes });
     }
     else
     {
         textboxAff.Text = mes;
     }
 }
Beispiel #4
0
 /// <param name="message"></param>
 /// <summary>
 /// Update textBoxRS232
 /// </summary>
 /// <param name="message"></param>
 public void textBoxUpdate(TextBox textboxAff, string mes)
 {
     try
     {
         if (textboxAff.InvokeRequired) ///InvokeRequired required compares the thread ID of the calling thread to the thread ID of the creating thread. If these threads are different, it returns true.
         {
             SetTextBoxCallBack d = new SetTextBoxCallBack(textBoxUpdate);
             Invoke(d, new object[] { textboxAff, mes });
         }
         else
         {
             textboxAff.Text = mes;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message.ToString());
     }
 }