Results 1 to 3 of 3

Thread: list box

  1. #1

    Thread Starter
    Lively Member meander's Avatar
    Join Date
    Jun 2004
    Posts
    121

    list box

    how do you have it so that it does something different depending on which item you double click in a list box? (like launch different forms)

  2. #2
    VB6, XHTML & CSS hobbyist Merri's Avatar
    Join Date
    Oct 2002
    Location
    Finland
    Posts
    6,654
    Just see what List1.ListIndex tells you. Or when you add an item, do this:

    VB Code:
    1. List1.AddItem "Yippee"
    2. List1.ItemData(List1.NewIndex) = 1
    3. List1.AddItem "Yay!"
    4. List1.ItemData(List1.NewIndex) = 2
    5. '... etc ...

    ... and then you can see a customized value by checking what List1.ItemData(List1.ListIndex) has.

    VB Code:
    1. Private Sub List1_DblClick()
    2. Dim Message As String
    3. Select Case List1.ItemData(List1.ListIndex)
    4.     Case 1
    5.         Message = "Yippeehee!"
    6.     Case 2
    7.         Message = "Yayhee!"
    8. End Select
    9. MsgBox Message, vbOk, "Reply"
    10. End Sub

  3. #3
    Lively Member rotcrules's Avatar
    Join Date
    Mar 2004
    Location
    SD
    Posts
    113
    VB Code:
    1. Private Sub ListBox1_DblClick()
    2. If ListBox1.selected(???the number???) then
    3. 'Put What you want here.
    4. End If
    5. End Sub
    I hope that helps
    Last edited by rotcrules; Jun 4th, 2004 at 03:22 PM.
    [Vbcode]If YourOpinion = WindowsIsCrap Then
    Kill Wndows
    Open Linux
    ElseIf YourOpinion = WindowsIsGreat Then
    Unload Me
    Else
    Get MSNTV
    End If[/vbcode]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width