Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. ComboBox Help

ComboBox Help

Scheduled Pinned Locked Moved Visual Basic
helptutorial
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jason Baggett
    wrote on last edited by
    #1

    I've got three comboboxes. ComboBox1 has two selections, (a) and (b). I can't figure out how to go about to pick one and driving ComboBox2. I'd like to pick (a) from ComboBox1 and have ComboBox2 know that when I pick (a), the associated data selections would be selectable in this ComboBox. Both (a) and (b)have specific data tied to each of them and I need it to know how to differentiate. When I pick from ComboBox2, this will also drive what I can select in ComboBox3, but I need help getting started first. Thanks.

    N 1 Reply Last reply
    0
    • J Jason Baggett

      I've got three comboboxes. ComboBox1 has two selections, (a) and (b). I can't figure out how to go about to pick one and driving ComboBox2. I'd like to pick (a) from ComboBox1 and have ComboBox2 know that when I pick (a), the associated data selections would be selectable in this ComboBox. Both (a) and (b)have specific data tied to each of them and I need it to know how to differentiate. When I pick from ComboBox2, this will also drive what I can select in ComboBox3, but I need help getting started first. Thanks.

      N Offline
      N Offline
      nlarson11
      wrote on last edited by
      #2

      In this event of combobox1 'combobox1_selectedindexchanged' determine which was selected and call the appropriate routine to load/replace the contents of combobox2.

      J 1 Reply Last reply
      0
      • N nlarson11

        In this event of combobox1 'combobox1_selectedindexchanged' determine which was selected and call the appropriate routine to load/replace the contents of combobox2.

        J Offline
        J Offline
        Jason Baggett
        wrote on last edited by
        #3

        Thanks. I hate to ask too much, but I am rusty (2 years since coding of any form). Could you please explain "which was selected and call the appropriate routine to load/replace the contents of combobox2"? I appreciate the help.

        N 1 Reply Last reply
        0
        • J Jason Baggett

          Thanks. I hate to ask too much, but I am rusty (2 years since coding of any form). Could you please explain "which was selected and call the appropriate routine to load/replace the contents of combobox2"? I appreciate the help.

          N Offline
          N Offline
          nlarson11
          wrote on last edited by
          #4

          When the event fires, you need to check combo1 for what the user selected. Then react accordingly. There are 3 properties you can check to do this. Once you know what they selected, then call the appropriate routine to load the correct values in combo2 that belong to the selection they made in combo1 the properties: Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged Select Case ComboBox1.SelectedIndex 'if you hardcoded the contents of combo1 Case 0 Call FillCombo2WithATypes() Case 1 Call FillCombo2WithBtypes() End Select Select Case ComboBox1.SelectedText 'what they see in the combo list Case "A - type " Call FillCombo2WithATypes() Case "B - type " Call FillCombo2WithBtypes() End Select Select Case ComboBox1.SelectedValue 'the code for what they see Case "A" Call FillCombo2WithATypes() Case "B" Call FillCombo2WithBtypes() End Select End Sub

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups