Listbox : do specific things on specific items

colelinux
09-07-2003, 11:05 AM
hi, i hope anyone can help me out, my problem is simple, as usual. :-)
lol

I have a Listbox, and in the listbox there 3 items (for example):
1) Dog
2) Cat 1
3) Cat 2

When I click on Dog, it'll show a MsgBox
When I click on other items, it'll.... hmm...close the program

How do i do that?

zak2zak
09-07-2003, 11:18 AM
May be this helps..
Use Select..Case Statement..?

Select Case List1.ListIndex
Case 0
Msgbox "Hai"
Case 1
MsgBox "How"
Case 2
Unload Form1
Set Form1 = Nothing
End Select

sPiKie
09-07-2003, 11:21 AM
This will work:

Private Sub List1_Click()
If List1.ListIndex = 0 Then
MsgBox "doggy"
Else
Unload Me
End If
End Sub

colelinux
09-07-2003, 11:31 AM
thanks! thanks! thanks! YOU GUYS AT EXTREME VB ARE THE NICEST PEOPLE I"VE EVER MET! :-)

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum