Click here to Skip to main content
15,867,686 members
Home / Discussions / Windows Forms
   

Windows Forms

 
AnswerRe: Winforms - automated retrieve static image Pin
Eddy Vluggen9-Oct-13 7:30
professionalEddy Vluggen9-Oct-13 7:30 
QuestionError during tableAdapterManager.UpdateAll unable to resolve Pin
Member 838780830-Jun-13 8:02
Member 838780830-Jun-13 8:02 
AnswerRe: Error during tableAdapterManager.UpdateAll unable to resolve Pin
Eddy Vluggen4-Jul-13 5:05
professionalEddy Vluggen4-Jul-13 5:05 
QuestionListBox does not update when DataSource is changed Pin
rbsbscrp17-May-13 5:36
rbsbscrp17-May-13 5:36 
AnswerRe: ListBox does not update when DataSource is changed Pin
rbsbscrp17-May-13 6:59
rbsbscrp17-May-13 6:59 
GeneralRe: ListBox does not update when DataSource is changed Pin
Eddy Vluggen24-May-13 2:59
professionalEddy Vluggen24-May-13 2:59 
GeneralRe: ListBox does not update when DataSource is changed Pin
Dave Kreskowiak24-May-13 5:23
mveDave Kreskowiak24-May-13 5:23 
GeneralRe: ListBox does not update when DataSource is changed Pin
rbsbscrp24-May-13 20:03
rbsbscrp24-May-13 20:03 
My thanks to all who responded.

>>
You can NOT so much as touch ANY part of a control from a thread other than the one that created it, the UI (or startup) thread. This is where your entire problem comes from.


My confusion was mostly that I was not trying to run a Method at all - I was just changing a Property (or what I thought was DATA). Upon more consideration, I realized that a Property is just syntactic sugar over a procedure call, anyway, so the "you can't run code from a different thread" rule applied even changing a Property.

However, I am mystified as to WHY this rule "no touchie from different thread" even exists. Sure, if I'm trying to update a TextBox from other threads then there *could* be confusion and a random mix of characters added from the various threads due to the asynchronous timing of the code in the different threads. Yes, there *could* be... it is *possible* - just like I could really mess up a data structure if I update it from many threads without synchronization.

But that is exactly what multithreaded coding is all about - synchronizing the use of common data structures (at least it is a major issue, if not the biggest issue).

But why would the compiler assume that I am needing multithreading synchronization when updating a Textbox? The truth is, I am doing something at timed intervals - I am using a timer. It just so *happens* that C# chooses internally to implement a timer via a separate new thread. That is not *my* problem. I'm not trying to append text to the textbox from 17 different timers or asynchronous threads. I'm simply trying to update a textbox at constant intervals - in this case the system chooses to do this via ONE (other) thread.

Suddenly now I have to become fully knowledgeable about multithreading and delegates and "invoking", etc. BAH! Unnecessary, unneeded, unwanted complexification.

Aside from all that, I especially did not appreciate that the code simply failed to do anything - I got no compiler warning/error nor any runtime problem. My dialogbox simply didn't update. Then I had the fire up The Google and go searching for why it didn't work. My first real clue was that if I caused the update to happen from the very same function, via a click of a button on the UI, then it worked. Whaaa? My code definitely worked, but only if executed via a pushbutton.

I've coded for years, and I'm teaching myself C# now, and "yeah" this is a noobie kinda problem, but geeeez what an unnecessary timewaster.

Okay, 'nuff whining. Thx to all who replied. I found some code example for doing a "invoke" via a deleagate, etc., etc., and got it working.
GeneralRe: ListBox does not update when DataSource is changed Pin
Eddy Vluggen24-May-13 23:03
professionalEddy Vluggen24-May-13 23:03 
GeneralRe: ListBox does not update when DataSource is changed Pin
Dave Kreskowiak25-May-13 3:55
mveDave Kreskowiak25-May-13 3:55 
GeneralRe: ListBox does not update when DataSource is changed Pin
rbsbscrp30-May-13 14:16
rbsbscrp30-May-13 14:16 
GeneralRe: ListBox does not update when DataSource is changed Pin
Dave Kreskowiak30-May-13 16:19
mveDave Kreskowiak30-May-13 16:19 
GeneralRe: ListBox does not update when DataSource is changed Pin
rbsbscrp30-May-13 17:38
rbsbscrp30-May-13 17:38 
GeneralRe: ListBox does not update when DataSource is changed Pin
Dave Kreskowiak31-May-13 4:25
mveDave Kreskowiak31-May-13 4:25 
GeneralRe: ListBox does not update when DataSource is changed Pin
rbsbscrp31-May-13 5:41
rbsbscrp31-May-13 5:41 
GeneralRe: ListBox does not update when DataSource is changed Pin
Eddy Vluggen31-May-13 6:29
professionalEddy Vluggen31-May-13 6:29 
GeneralRe: ListBox does not update when DataSource is changed Pin
Eddy Vluggen31-May-13 6:27
professionalEddy Vluggen31-May-13 6:27 
GeneralRe: ListBox does not update when DataSource is changed Pin
rbsbscrp31-May-13 7:22
rbsbscrp31-May-13 7:22 
GeneralRe: ListBox does not update when DataSource is changed Pin
Eddy Vluggen31-May-13 7:30
professionalEddy Vluggen31-May-13 7:30 
GeneralRe: ListBox does not update when DataSource is changed Pin
rbsbscrp31-May-13 7:39
rbsbscrp31-May-13 7:39 
GeneralRe: ListBox does not update when DataSource is changed Pin
Eddy Vluggen31-May-13 8:32
professionalEddy Vluggen31-May-13 8:32 
GeneralRe: ListBox does not update when DataSource is changed Pin
TnTinMn6-Jun-13 9:08
TnTinMn6-Jun-13 9:08 
GeneralRe: ListBox does not update when DataSource is changed Pin
rbsbscrp6-Jun-13 12:38
rbsbscrp6-Jun-13 12:38 
GeneralRe: ListBox does not update when DataSource is changed Pin
TnTinMn6-Jun-13 13:26
TnTinMn6-Jun-13 13:26 
AnswerRe: ListBox does not update when DataSource is changed Pin
Chirag Baroliya R24-May-13 2:25
Chirag Baroliya R24-May-13 2:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.