BUG: [ Character May Sort Incorrectly in List or Combo Box (74132)



The information in this article applies to:

  • Microsoft Visual Basic Standard Edition for Windows 1.0
  • Microsoft Windows 3.0
  • Microsoft Windows 3.1

This article was previously published under Q74132

SYMPTOMS

An example below demonstrates a problem using the Sorted property to sort a string beginning with a bracket ([) in either a list box or combo box in Microsoft Visual Basic version 1.0 for Windows.

STATUS

This sorting problem is caused by Microsoft Windows versions 3.0 or 3.1, not by Visual Basic. Microsoft is researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

Steps to Reproduce Problem

  1. In the Visual Basic environment, choose New Project from the File menu.
  2. Place two list boxes or two combo boxes on the form.
  3. From the Properties Bar, set the Sorted property for either the two list boxes or two combo boxes to True.

    NOTE: Do not invoke List1.Sorted = -1 within the code of an event procedure because this causes the run-time error "'Sorted' property cannot be set at run time."
  4. Now add some code to the Form_Click event procedure. Below are two separate examples of the code to add depending on if you are using list boxes or combo boxes:
       Sub Form_Click ()         Sub Form_Click ()
          List1.AddItem "["         Combo1.AddItem "["
          List1.AddItem "\"         Combo1.AddItem "\"
          List1.AddItem "a"         Combo1.AddItem "a"
    
          List2.AddItem "a"         Combo2.AddItem "a"
          List2.AddItem "\"         Combo2.AddItem "\"
          List2.AddItem "["         Combo2.AddItem "["
       End Sub                   End Sub
    						
  5. Run the code by pressing the F5 function key or choosing Start from the Run menu.
  6. Click the form to see the sequence "a [ \" in the first list box or combo box and to see the different sequence "[ \ a" in the second list box or combo box.
This reveals an inconsistency with an internal Windows 3.0 sorting routine. If you replace the character "[" with the character "b", the two boxes correctly sort in the same order: "\ a b". The problem is with sorting the "[" character.

Modification Type:MajorLast Reviewed:11/18/2003
Keywords:kbbug KB74132