Nov 20, 2002 #1 adi316 Programmer Joined Sep 10, 2002 Messages 35 Location 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 Joined Nov 13, 2002 Messages 124 Location 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 Joined May 1, 2002 Messages 828 Location 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 Joined Jul 9, 2001 Messages 35 Location 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!
Nov 20, 2002 Thread starter #5 adi316 Programmer Joined Sep 10, 2002 Messages 35 Location CA thank u Upvote 0 Downvote