UI Thread Delegate


/ Published in: C#
Save to your folder(s)



Copy this code and paste it in your HTML
  1. public Form1()
  2. {
  3. InitializeComponent();
  4.  
  5. IntPtr handle = this.Handle;//force creation of handle
  6.  
  7. ThreadStart ts = delegate
  8. {
  9. //UI operations
  10. progressBar1.Value = 80;
  11. };
  12. //executes synchronously on ts Thread
  13. Invoke(ts, null);
  14. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.