multithreading - Using a thread with designer objects vb.net -


I have a big problem I'm currently preparing an antivirus, and it's coming very well. But having all the scanning engines running on the same thread, the IE main one is causing the app to become unresponsive during the process of interrupting the loading and multithreading to increase the overall performance of my application and overall performance. Have tried to implement. But, every time I try, I get an error of cross threading, I. E. I can not use the form designer progress bars, buttons and labels etc. I just want to know why this error has been thrown, and how it is decided.

Thanks in advance!

If you are not in the UI thread, then use InvokeRequired to check, then you are InvokeRequired True , And therefore you can safely turn a representative from the UI thread into control:

  public sub-set text (by text as string) if (M. invocaruair) then ' Invoke a representative from the UI thread Invoke (DirectCast (Sub () Label1.Text = "Test", MethodInvoker) Other Button Button1.Text = Text End if End Sub  

It is unsafe to call a control from a thread that also controls the control using the no invention method. Take a look at this example:


Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -