Reputation: 75
Im trying to call some windows forms code (like setting label.visible = true in some event code, everything compiles ok, but form does not react to change! What could be the problem?
Problem is in lines:
labelNewCall.Visible = true;
timerNewCall.Enabled = true;
code : http://pastebin.com/gV28PN4P
also other code did not work, until i reordered some of it (order is not important but it did not work otherwise... )
Upvotes: 1
Views: 5277
Reputation: 16077
Use invoke to access object in a windows forms/controls thread
Reference - http://www.dailycoding.com/...formscontrols_thread.aspx
Upvotes: 0
Reputation: 17909
You can also try a handy little method that you can place in your inner-loop:
Application.DoEvents();
Here's the MSDN write up:
http://msdn.microsoft.com/en-us/library/system.windows.forms.application.doevents.aspx
Upvotes: 1
Reputation: 1038820
This could be because the soundCapture_BufferThrown
callback function is not run on the GUI thread. Read this post for more details about threading in WinForms.
Upvotes: 1
Reputation: 26632
Do you call this method in another than UI thread? If so, you should use Invoke and/or BeginInvoke method.
Look at article What's up with BeginInvoke?.
Upvotes: 1