I am using visual studio 2008 with C# developing an window application,
I want to displsy blinking text with marquee on label using thread.But it generates error :--Cross thread error. What is this and pls solve my problem.
adobe71
0
Junior Poster in Training
Recommended Answers
Jump to PostAny changes to UI objects must be done by the UI thread.
You need to invoke the function call that changes the text.
There are several examples of using delegates and invoking, just do a search and you should find something. If not, just ask.
Jump to PostIf you want something more simple do the following:
if(ctrl.InvokeRequired) { ctrl.Invoke( (MethodInvoker)delegate { ctrl.Text = "hola!"; }); }
The only difference between this and nick's method, is that he will have a specific delegate (recallable), and I'm just making one on the fly.
All 8 Replies
nick.crane
342
Veteran Poster
adobe71
0
Junior Poster in Training
nick.crane
342
Veteran Poster
nick.crane
342
Veteran Poster
nick.crane
342
Veteran Poster
PierlucSS
52
Junior Poster
nick.crane
342
Veteran Poster
PierlucSS
52
Junior Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.