SHARE
TWEET

Untitled

a guest May 5th, 2012 63 Never
  1. C# - How to change value of a progress bar in a secondary thread
  2. .......
  3. bulkCopy.NotifyAfter = 2000;
  4. bulkCopy.SqlRowsCopied += new SqlRowsCopiedEventHandler(bulkCopy_SqlRowsCopied);
  5. .......
  6.        
  7. public static class ControlExtensions
  8. {
  9.     public static void Invoke(this Control control, Action action)
  10.     {
  11.         if (control.InvokeRequired) control.Invoke(new MethodInvoker(action), null);
  12.         else action.Invoke();
  13.     }
  14.  }
  15.        
  16. progressBar.Invoke(() => { progressBar.PerformStep(); };
  17.        
  18. Task.Factory.StartNew(MyBulkCopyMethod);
RAW Paste Data
Top