# [resolved] Visual C++ Listbox Question



## ricer333 (Sep 17, 2004)

*Visual C++ Listbox Question*

Okay, so I am a bit new to the whole Visual envirnoment, but not new to programming in general. Anyways, I have a Listbox set up with it's collection (basically list of drive letters A-Z). The problem lies in trying to grab the text in the listbox. IF the collection item IS HIGHLIGHTED, then grabbing it is no problem. However, if the item is not selected (can do this by clicking the up/down arrows and scrolling through the collection) then the string returned is EMPTY ("").

Any help would be a big one. Also, if anyone knows how to default to a different index other than the zero (basically defaulting to something other than the first item in the collection) that would be another big help.


----------



## ricer333 (Sep 17, 2004)

*Update:*

Okay, after much searching (googling really) I have come to the realization that what I was trying to do CANNOT be done. The user must specifically select an item (at least one - if a single choice ListBox). For some reason, just scrolling through the items doesn't neccessarily 'select' the item, even though the ListBox knows enough of what is being displayed.

Thanks again Microsoft for your wonderful programming environments! :cussing:

BTW, I solved this by using a ComboBox and therefore, once the down arrow is selected, the items are selected as well.


----------

