Advertisement
Guest User

Untitled

a guest
May 5th, 2012
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  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);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement