Nov 20, 2002 #1 adi316 Programmer Sep 10, 2002 35 0 0 CA i need to have an ok button that returns what index i am on in a listbox. anyone know how to do it? tia
i need to have an ok button that returns what index i am on in a listbox. anyone know how to do it? tia
Nov 20, 2002 #2 CmPaiva Programmer Nov 13, 2002 124 0 0 PT Use List1.ListIndex For the text in that index, use List1.List(List1.ListIndex) Carlos Paiva Upvote 0 Downvote
Nov 20, 2002 #3 TheVampire Programmer May 1, 2002 828 0 0 US The .ListIndex property will return the index for the currently selected item. -1 if no item is selected. Robert Upvote 0 Downvote
The .ListIndex property will return the index for the currently selected item. -1 if no item is selected. Robert
Nov 20, 2002 #4 DaveShaw Programmer Jul 9, 2001 35 0 0 GB Running this Bit of code will return the index as c Private Sub Command1_Click() Dim a, c As Integer For a = 0 To (List1.ListCount - 1) If List1.Selected(a) = True Then c = a Next a MsgBox (c) End Sub the first object in the list will be 0. Thanx Dave Shaw! Upvote 0 Downvote
Running this Bit of code will return the index as c Private Sub Command1_Click() Dim a, c As Integer For a = 0 To (List1.ListCount - 1) If List1.Selected(a) = True Then c = a Next a MsgBox (c) End Sub the first object in the list will be 0. Thanx Dave Shaw!