I am trying to set text to label Label_caller.Text = phone_number
and I get this error: "System.InvalidOperationException: Cross-thread operation not valid: Control 'Label_caller' accessed from a thread other than the thread it was created on." How do I overcome this problem? How do I use keyword Me.?
相关问题
- How to let a thread communicate with another activ
- React Native Inline style for multiple Text in sin
- 'System.Threading.ThreadAbortException' in
- how to use special characters like '<'
- Why it isn't advised to call the release() met
相关文章
- vb.net 关于xps文件操作问题
- 放在input的text下文本一直出现一个/(即使还没输入任何值)是什么情况
- Difference between Thread#run and Thread#wakeup?
- Java/Spring MVC: provide request context to child
- Threading in C# , value types and reference types
- Checking for DBNull throws a StrongTypingException
- RMI Threads prevent JVM from exiting after main()
- Using the typical get set properties in C#… with p
I am probably answering quite late but adding following code in form load event seems solving problem.
Not sure though it's perfect answer or not:
In Windows, you can access UI elements only on the UI thread. For that reason, if you need to access them from another thread, you may need to invoke that action on the UI thread.
You need to use the following method to update the text box. This will check if invoking on the main thread is required and if needed, call the same method on the UI thread.