how do i define each item of a list, for example, if I had 5 items in a list, how would i be able to just take one of the items and msgbox its value?
Printable View
how do i define each item of a list, for example, if I had 5 items in a list, how would i be able to just take one of the items and msgbox its value?
VB Code:
Private Sub List1_Click If List1.ListCount = 0 Then Exit Sub MsgBox List1.List(List1.ListIndex) End Sub
hiya!VB Code:
msgbox list1.list(x) 'Put any number or variabel where the x is
VB Code:
MsgBox List1.List(0)
Try this:Quote:
Originally Posted by ajames
VB Code:
Private Sub Form_Load() Dim a As Long For a = 1 To 10 List1.AddItem "This is Item " & a Next a End Sub Private Sub List1_Click() With List1 MsgBox "You Clicked on " & .Text & " which has and index of " & .ListIndex End With End Sub
thanks
Not bad four responses in less than two minutes.