|
-
Dec 2nd, 2005, 12:01 PM
#1
Thread Starter
Addicted Member
[RESOLVED] listboxes
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?
-
Dec 2nd, 2005, 12:05 PM
#2
Re: listboxes
VB Code:
Private Sub List1_Click
If List1.ListCount = 0 Then Exit Sub
MsgBox List1.List(List1.ListIndex)
End Sub
-
Dec 2nd, 2005, 12:06 PM
#3
Re: listboxes
hiya!
VB Code:
msgbox list1.list(x) 'Put any number or variabel where the x is
-
Dec 2nd, 2005, 12:06 PM
#4
Fanatic Member
-
Dec 2nd, 2005, 12:07 PM
#5
Re: listboxes
 Originally Posted by ajames
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?
Try this:
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
Regards,
Mark
Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."
-
Dec 2nd, 2005, 12:17 PM
#6
Thread Starter
Addicted Member
-
Dec 2nd, 2005, 02:55 PM
#7
Re: [RESOLVED] listboxes
Not bad four responses in less than two minutes.
Regards,
Mark
Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|