Posted By

jx_boi on 08/30/10


Tagged

thread ui Delegate


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

Tyster


UI Thread Delegate


 / Published in: C#
 

  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  

You need to login to post a comment.