Combo Box >> Help required ASAP?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jafarsibtain
    New Member
    • May 2007
    • 2

    #1

    Combo Box >> Help required ASAP?

    hi..

    I am creating a form where there are two combo Boxes (drop Down)
    > Program_Combo_b ox
    > Course_Code_Com bo

    in the Program Combo Box there are five items in the list >
    1. BIT
    2.BCA
    3. MCA
    4. MBA
    5. MIT

    now my problem is that i want to change the list contents of Course Code combo Box on the basis of selection from Program combo

    say if i select BIT in Program combo Box it should immediately fill the course combo box list with these items
    CST-101
    CST-102
    CST-103


    now if i select MBA in Program combo Box , my course combo Box will show the course of MBA program , i.e. MM1, FM2. AC3 etc..

    that is to say i want to fill the list of one combo box based on the selection of another combo box...

    i am not using n e database ... just static values ..


    please guide me how to do this...as i m new in VB..
    i m using VB6 version...


    please help me..asap

    waiting for ur replies...

    thank you...

    jafar
  • shidec
    New Member
    • May 2007
    • 26

    #2
    U can add program in Program_Combo_B ox Click Event like this

    Code:
    Private Sub Program_Combo_Box_Click()
     if Program_Combo_Box.ListIndex=0 then
        Course_Combo_Box.Clear
        Course_Combo_Box.AddItem("CST-001")
        Course_Combo_Box.AddItem("CST-002")
        Course_Combo_Box.AddItem("CST-003")
     ElseIf Program_Combo_Box.ListIndex=1 then
        Course_Combo_Box.Clear
        Course_Combo_Box.AddItem("MM-121")
        Course_Combo_Box.AddItem("MM-132")
        Course_Combo_Box.AddItem("MM-143")
     End If
    End Sub

    Comment

    • jafarsibtain
      New Member
      • May 2007
      • 2

      #3
      Originally posted by shidec
      U can add program in Program_Combo_B ox Click Event like this

      Code:
      Private Sub Program_Combo_Box_Click()
       if Program_Combo_Box.ListIndex=0 then
          Course_Combo_Box.Clear
          Course_Combo_Box.AddItem("CST-001")
          Course_Combo_Box.AddItem("CST-002")
          Course_Combo_Box.AddItem("CST-003")
       ElseIf Program_Combo_Box.ListIndex=1 then
          Course_Combo_Box.Clear
          Course_Combo_Box.AddItem("MM-121")
          Course_Combo_Box.AddItem("MM-132")
          Course_Combo_Box.AddItem("MM-143")
       End If
      End Sub

      problem solved....thank you so much...

      Comment

      Working...