The information in this article applies to:
SYMPTOMSResetting the ListIndex property of a list box, combo box, directory list box, or a file list box at run time generates a Click event for the control. For a drive list box, resetting the ListIndex property generates a Change event. CAUSEThis is a result of the Windows subclass definition for these controls. When an item in one of these list boxes is selected, a Click event (or Change event for drive list box) occurs and the ListIndex property is updated. Conversely, when the ListIndex property is changed, a message occurs, generating the corresponding event. WORKAROUNDUse the KeyUp procedure instead of click, and then call KeyUp when a key is pressed. STATUSMicrosoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. Microsoft is researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available. MORE INFORMATION
This behavior is not documented in the Visual Basic documentation or
online Help. This behavior can cause some unexpected results. For example,
if code in a Click (or Change) event procedure is assigning the selected
items in the list box to an array (or directly to the Text property of
another control), resetting the ListIndex property causes another such
assignment, but with the new item. Steps to Reproduce Problem
REFERENCES
"Programming Windows: the Microsoft Guide to Writing Applications for
Windows 3," by Charles Petzold, Microsoft Press, 1990 Additional query words: buglist1.00 buglist2.00 buglist3.00 2.00 3.00
Keywords : |
Last Reviewed: September 1, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |