Visual Basic

Moderators: None (Apply to moderate this forum)
Number of threads: 18013
Number of posts: 55386

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Re: Strange bug in listbox with Multiselect = 2 and Sorted = True Posted by kapiloo7 on 8 Dec 2004 at 10:51 PM
: Set a ordinary listbox with Sorted=True and Multiselect=2
:
: Private Sub Form_Load()
: List1.AddItem "ann"
: List1.AddItem "beth"
: List1.Selected(0) = True
: End Sub
:
: Start the program, then type in "b". The second item will be higlighted and selected, as it should, leaving the first one unselected. But - one or two seconds later, the first item is selected again!!!
:
: Further testing shows that the "ann" item now has the Selected property set to False - even if it (incorrectly) shows up as "selected" - along with the "beth" item (which now has been selected by typing "b")...
:
: Any way around this?
:

this might be all happening 'coz of "Sorted=True". See MSDN help for this property which says,
        When this property is True, Visual Basic handles almost all necessary string processing to maintain alphabetic order, including changing the index numbers for items as required by the addition or removal of items.

       Note:  Using the AddItem method to add an element to a specific location in the list may violate the sort order, and subsequent additions may not be correctly sorted.






 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.