Do you mean the listindex property (for a listbox)?
Dim a As Integer
Dim b As Integer
Private Sub Command1_Click()
If List1.ListIndex = -1 Then
MsgBox "nothing selected"
ElseIf List1.ListIndex = 0 Then
a = List1.ListIndex + 1
MsgBox "The value is " & a
a = 0
b = 0
Exit Sub
ElseIf List1.ListIndex = 1 Then
b = List1.ListIndex + 1
MsgBox "The value is " & b
a = 0
b = 0
Exit Sub
End If
End Sub
Private Sub Form_Load()
List1.AddItem "Cat"
List1.AddItem "Dog"
End Sub
Prozeen
Junior Poster in Training
52 posts since Jun 2007
Reputation Points: 10
Solved Threads: 4
Try to use the Listindex of the item
else
try to use ItemData property of the control.
debasisdas
Posting Genius
6,872 posts since Feb 2007
Reputation Points: 666
Solved Threads: 434
The code is already provided to you.
debasisdas
Posting Genius
6,872 posts since Feb 2007
Reputation Points: 666
Solved Threads: 434
Prozeen
Junior Poster in Training
52 posts since Jun 2007
Reputation Points: 10
Solved Threads: 4
Now its really too much. The code is so simple ,very basic level . How do u expect all the spoon feeding after being provided with alll the sample code on a free forum like this.
debasisdas
Posting Genius
6,872 posts since Feb 2007
Reputation Points: 666
Solved Threads: 434