Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Decipher if a ListBox Item is Selected 1

Status
Not open for further replies.

checkai

Programmer
Jan 17, 2003
1,629
US
I have a button that needs to make sure that an Item in the List box is selected. Not sure which method to call or property to check on the button_click event..

Thanks,

DLC
 
If a list box has no item selected, the default selected index is -1. So in your button click event, you could simply do a

If ListBox.SelectedIndex = -1 Then
'code to run if nothing is selected
else
'code to run if there is a selection made
end If

hth

D'Arcy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top