PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Martin Francom on April 05, 2010, 02:14:19 AM

Title: ListBox problem
Post by: Martin Francom on April 05, 2010, 02:14:19 AM
I am trying to get the  ListBox with checkboxes (that Paul posted) working.   
When I try to add item to the listbox the program crashes.  I can not see were I am going wrong.  Can some help?            Attached is the example project.

Title: Re: ListBox problem
Post by: David Kenny on April 05, 2010, 05:23:29 AM
Marty,

I was bored tonight and decided to play with your project.
You forced me to make some guesses about what you wanted in the listbox and then what should end up in the textbox.  I hope I guessed right. 

Also, the code I wrote assumes that the listbox will not be sorted, have items add or removed, etc. as the global warning-label data is tied to it.  If you wanted to allow changes to the listbox, you would have to perform corresponding changes to the global warning-label array.

David
Title: Re: ListBox problem
Post by: Martin Francom on April 05, 2010, 02:23:59 PM
David,  again thanks... This is exactly what I need. 

My problem was the the program was crashing after I loaded the ListBox items.  I see that you used a shorter string for the item.    I assume that length of the string I was using must have been causing the program to crash.  The string I was using was longer than the width of the list box.   Am I correct in assuming that was what was causing the program to crash?

To test that theory I parsed the longer message (3) instead of the short message (2) that you used,  and the program crashed.   The longer message being longer than the width of the listBox.  Am I correct in concluding that a string used as an idem in the listbox cannot be longer than the width of the list box?   Lest the display of the ListBox will crash the program?


Title: Re: ListBox problem
Post by: David Kenny on April 05, 2010, 02:54:12 PM
QuoteI see that you used a shorter string for the item.
It's one of the assumptions I made. The user of thee program selects from a short, familiar list to populate a more detailed label destined for the end user (patient).

QuoteAm I correct in assuming that was what was causing the program to crash?
It appears to be the length of the string itself.  If I made the listbox wide enough to hold the largest string, it still crashed.  I haven't looked into it, but I don't remember such a small text-size limit on a listbox.