Selected Prop of List Box Can Cause Click Event & Out of Stack (110957)
The information in this article applies to:
- Microsoft Visual Basic Standard Edition for Windows 3.0
- Microsoft Visual Basic Professional Edition for Windows 3.0
This article was previously published under Q110957 SUMMARY
The Selected property applies to list box and file list box controls. When
you change the selected state of a list box item by using code to set the
Selected property at run time, a Click event occurs -- just as if you had
actually clicked with the mouse. A Click event does not occur if you set
the item's Selected property to a value that keeps the item's current
selected or unselected state.
You need to take care when changing the Selected property within the Click
event procedure for a list or file list box. Clicking an item in a list
control causes a Click event and can change a selection. That changed
selection can affect whether your code's subsequent change to an item's
Selected property causes another Click event. The resulting second click
event can cause recursion and "Out of Stack Space" or other errors if you
designed your Click event procedure incorrectly. The More Information
section below provides examples showing how to avoid recursion problems.
This behavior is by design.
Modification Type: | Major | Last Reviewed: | 10/29/2003 |
---|
Keywords: | KB110957 |
---|
|