Hi, Can somebody please explain the following to me. If I try to change a UltraLabels Text or UltraButtons text and I have not checked to see if Invoke is required then I get an Error messages telling me so (Which is what I want when debugging so I can fix it) now what I cannot seem to make happen is an Cross Thread Error when I read an UltraLabels text or UltraButtons text. If I stop my code at a specific line where I know I'm going to read an objects text (or anything else) I can see that the text parameter says {"Cross Thread Operation not Valid.....} yet my code continues with no error.
It is my understanding that you must Invoke when ever you SET/GET any info from an object that was created on another thread.
Is this the correct behavior? or do I not have a setting for checking this activated? I can see that the CheckForIllegalCrossThreadCalls is set to true.
As the code continues with no error what is this actually doing to my program as it does seem to be reading the text correctly of the label or button?
Thank You
-Paul
Paul,
It is correct that UI Controls in Windows Forms are not thread safe and you can see a list of the thread safe members in the Thread Safety section of System.Windows.Forms.Control on MSDN. As far as the behavior of the Text property, this is actually inherited from the Control class and the behavior that you are seeing is the same as what you would see if using a Microsoft Label control.
If you want a better understanding of threading then I recommend the following resources:
Let me know if you have any questions with this matter.
Hi, Thank you for reply.
I have read all these before and alot more, most of the information is about updating another objects info not getting info. I was looking for a answer on something that I cannot found an answer to in any of the info I have read. My question was not generally directed at Infragistics products its just that I use them all the time. As this is a general forum I was hoping that somebody could help answer my question.
All I wanted to know was why is it that when I try to change a objects settings like Text I will get a Cross Thread error which I understand and while debugging I can fix, yet if I use something like - if fom1.label1.Text = "blah" (which is on another thread) I do not get an error message yet I can see in the debug info that a Cross Thread error was raised. My program continues to run with no error and the returned results is correct.
So my quesion is when reading another objects info on another thread why do I not get a Cross Thread error message like I do if trying to change a objects info?