Results 1 to 9 of 9

Thread: How do i use a combo box?

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2000
    Location
    Oshawa, Ontario
    Posts
    5

    Smile

    I have no idea how to use a combo box, I can enter the options, just dont know how to give them individual commands.

    Can anybody help?

  2. #2
    Addicted Member jcouture100's Avatar
    Join Date
    Aug 1999
    Posts
    141

    A little clarification...

    What exactly do you mean by "...I can enter the options, just dont know how to give them individual commands."

    Do you want to know how to put the info into the ComboBox or are you looking at triggering a certain event after a particular value is selected?
    JC

  3. #3
    Guest
    if you want to add items to the combobox, then all you have to do is put this into your form_load event.

    combo1.additem "Whatever"

    and keep doing that untill you have everything that you want. then you have to put some code in the combo1_change event so when you select one of those items, your code will execute. i hope i was of some help.

  4. #4
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Exclamation

    Correction. You have to use Combobox_Click event to trap when you select items from the list. Change event fires when you type in the textbox of the combobox.

  5. #5
    Guest
    oh yeah, heh i rarely use cboxes so i forget. thanks for correction, i guess.

  6. #6

    Thread Starter
    New Member
    Join Date
    May 2000
    Location
    Oshawa, Ontario
    Posts
    5
    I'm not sure how to explain what I'm looking for.

    Okay, I have created the combobox, inside the combobox I have the options (for the user to select) entered. I used the List option in the preference window to enter the user options.

    What I'd like to know is how do I tell the program what I'd like to do with each individual option within the combobox.

    Like if my box has "Option1" as one of the choices, I want to know how to tell the program what to do when that is selected.

    Thanks a lot!!

  7. #7
    Guest

    This should help

    Code:
    If Combo1.Text = "Option 1" Then MsgBox ("you selected Option 1")

  8. #8

    Thread Starter
    New Member
    Join Date
    May 2000
    Location
    Oshawa, Ontario
    Posts
    5

    Thumbs up Thanks

    Thanks a lot!!! Really appreciate it, works fine.

  9. #9
    Addicted Member jcouture100's Avatar
    Join Date
    Aug 1999
    Posts
    141
    You could also use a SELECT CASE statement to do the same thing.
    Code:
    strTemp = Combo1.Text
    Select Case strTemp
       Case "Option 1"
          'Put your code for option 1 here
       Case "Option 2"
          'Put your code for option 2 here
       Case "Option 3"
          'Put your code for option 3 here
       Case "Option 4"
          'Put your code for option 4 here
       Case Else
          'Put code for any other selection here.
    End Select
    Hope this helps.
    JC

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