Updating form controls from a spawned thread
-
I am trying to update a textbox in my main form, from a thread that I started in the click handler of a button of the form itself .... it keeps sending the exception that I can't do that from a thread other than that which created the control ... how can it be ? how can I get to update that damn textbox using a different thread ? there' s no other way my program can work .....
-
I am trying to update a textbox in my main form, from a thread that I started in the click handler of a button of the form itself .... it keeps sending the exception that I can't do that from a thread other than that which created the control ... how can it be ? how can I get to update that damn textbox using a different thread ? there' s no other way my program can work .....
From your thread;
List MyData;
UpdateGUI(MyData);In the form;
void UpdateGUI(List someData)
{
if (InvokeRequired)
{
Invoke(new Action>(UpdateGUI), new object[] { someData });
return;
}
// update the gui here
}MSDN[^] holds some nice examples.
Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]
-
I am trying to update a textbox in my main form, from a thread that I started in the click handler of a button of the form itself .... it keeps sending the exception that I can't do that from a thread other than that which created the control ... how can it be ? how can I get to update that damn textbox using a different thread ? there' s no other way my program can work .....
This article[^] tells you more about the subject. :)
Luc Pattyn [My Articles] Nil Volentibus Arduum
-
This article[^] tells you more about the subject. :)
Luc Pattyn [My Articles] Nil Volentibus Arduum
-
This article[^] tells you more about the subject. :)
Luc Pattyn [My Articles] Nil Volentibus Arduum
Are you all right my old friend? We haven't seen you in such a long time.
*pre-emptive celebratory nipple tassle jiggle* - Sean Ewington
"Mind bleach! Send me mind bleach!" - Nagy Vilmos
CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier
-
Are you all right my old friend? We haven't seen you in such a long time.
*pre-emptive celebratory nipple tassle jiggle* - Sean Ewington
"Mind bleach! Send me mind bleach!" - Nagy Vilmos
CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier
No worries, I'm fine, thanks. After long consideration I have decided not to spend time around here anymore. I don't like what CP has turned itself into; when publishing articles became nearly impossible, the bugs & sucks forum became the most active one, and CP staff didn't seem to care about it, I decided it was time to move on. When they seem to focus on membership counts, parallel sites, cosmetics, i.e. everything but quality and contributor's comfort, well that is their choice. The automatic downvote on every new message nailed it for me; it was yet another example of the don't-think-don't-test policy that had crept in. Maybe in the mean time things have changed for the better (I doubt it), I have no idea what the functionality or quality of the site currently is, I do know the new layout is making sure I won't return. I have enjoyed the site and the community for many years; I learned a lot in the 5+ years I have been active here, and I am grateful for the guidance people like yourself have offered. I'll miss a number of nice guys (some of them long gone), and I will cherish the good memories, however this chapter has been closed. So goodbye it is. :beer: PS: While I much appreciate your enquiry, I unchecked e-mail notifications, as I don't want to enter a discussion on this subject. I had decided to leave quietly, and don't want to stir things up now.
Luc Pattyn [My Articles] Nil Volentibus Arduum
-
No worries, I'm fine, thanks. After long consideration I have decided not to spend time around here anymore. I don't like what CP has turned itself into; when publishing articles became nearly impossible, the bugs & sucks forum became the most active one, and CP staff didn't seem to care about it, I decided it was time to move on. When they seem to focus on membership counts, parallel sites, cosmetics, i.e. everything but quality and contributor's comfort, well that is their choice. The automatic downvote on every new message nailed it for me; it was yet another example of the don't-think-don't-test policy that had crept in. Maybe in the mean time things have changed for the better (I doubt it), I have no idea what the functionality or quality of the site currently is, I do know the new layout is making sure I won't return. I have enjoyed the site and the community for many years; I learned a lot in the 5+ years I have been active here, and I am grateful for the guidance people like yourself have offered. I'll miss a number of nice guys (some of them long gone), and I will cherish the good memories, however this chapter has been closed. So goodbye it is. :beer: PS: While I much appreciate your enquiry, I unchecked e-mail notifications, as I don't want to enter a discussion on this subject. I had decided to leave quietly, and don't want to stir things up now.
Luc Pattyn [My Articles] Nil Volentibus Arduum
Just in case you read this message, I wish you well for the future, and you should leave here knowing that you were appreciated, and that you did make a difference - and no one can ask for more than that. All the best for the future my friend, and if I'm ever back over in Belgium, the drinks are on me.
*pre-emptive celebratory nipple tassle jiggle* - Sean Ewington
"Mind bleach! Send me mind bleach!" - Nagy Vilmos
CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier