Populate 2nd combobox based on selction on 1st combo box

Posted on 2011-05-03
Last Modified: 2013-11-12
Advance thanks. I am using 2 comboboxes. Each comboxes comb1, comb2 is already populated with values. Comb1 has A,B,C,D,E. Comb2 has 1,2,3,4,5,6,7,8,9.
If i select "A" from comb1 , should display "5","6", "9" in comb2
If i select "B" from comb2, should display "1","2","6"
Can you help me the best way to do this.

Kind regards,
Question by:poojasureshkumar
    LVL 83

    Assisted Solution

    LVL 1

    Accepted Solution

    Hi Pooja,

    If I understand you correctly, adding the following two subs along with any additional "Case" lines you need should do the job...

    	Private Sub Comb1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Comb1.SelectedIndexChanged
    		Select Case Comb1.SelectedItem
    			Case "A"
    				AssignComb2Values({5, 6, 9})
    			Case "B"
    				AssignComb2Values({1, 2, 6})
    		End Select
    	End Sub
    	Private Sub AssignComb2Values(ByVal vals())
    	End Sub

    Open in new window

    Hope this helps!

    Humble Beginnings :)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
    A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
    This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA.…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now