Results 1 to 3 of 3

Thread: [RESOLVED] silly question about combo/listboxes?

  1. #1

    Thread Starter
    Addicted Member clownboy's Avatar
    Join Date
    Aug 2008
    Location
    Wellington, NZ
    Posts
    137

    Resolved [RESOLVED] silly question about combo/listboxes?

    simply, if the combobox has either listindex 1, 5, 7 or 10 selected then it does an action. can someone show me how to do so?

  2. #2
    "Digital Revolution"
    Join Date
    Mar 2005
    Posts
    4,471

    Re: silly question about combo/listboxes?

    vb Code:
    1. Option Explicit
    2.  
    3. Private Sub Combo1_Click()
    4.    
    5.     Select Case Combo1.ListIndex
    6.         'Note: ListIndex starts at 0!
    7.         'So first item in list will have ListIndex of 0, 2nd, 1, etc.
    8.         Case 1, 5, 7, 10
    9.             DoSomething
    10.     End Select
    11.    
    12. End Sub
    13.  
    14. Private Sub DoSomething()
    15.     MsgBox "Um, what do you want me to do?", vbQuestion, "You told me to do something?"
    16. End Sub
    17.  
    18. Private Sub Form_Load()
    19.  
    20.     'Load some items.
    21.     Dim i As Integer
    22.    
    23.     For i = 1 To 11
    24.         Combo1.AddItem CStr(i)
    25.     Next i
    26.    
    27. End Sub

  3. #3

    Thread Starter
    Addicted Member clownboy's Avatar
    Join Date
    Aug 2008
    Location
    Wellington, NZ
    Posts
    137

    Re: silly question about combo/listboxes?

    and there it is lol, thank you

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