public void DispCount(string str)
 {
     if (labelCount.InvokeRequired)
     {
         labelDelegate d = new labelDelegate(DispCount);
         Invoke(d, new object[] { str });
     }
     else
     {
         labelCount.Text = str;
     }
 }
 public void DispError(string str)
 {
     if (labelError.InvokeRequired)
     {
         labelDelegate d = new labelDelegate(DispError);
         Invoke(d, new object[] { str });
     }
     else
     {
         labelError.Text = str;
     }
 }
Exemple #3
0
 private void UpdateLabel(string Result, Label Dest)
 {
     if (Dest.InvokeRequired)
     {
         // It's on a different thread, so use Invoke.
         labelDelegate d = new labelDelegate(_UpdateLabel);
         try
         {
             this.Invoke(d, new object[] { Result, Dest });
         }
         catch (Exception)
         {
             // exception only occurs when program is exiting. nothing to do.
         }
     }
     else
     {
         // It's on the same thread, no need for Invoke
         Dest.Text = Result;
     }
 }