Cherries and Bananas

Discussion in 'AutoCAD' started by stck2mlon, May 7, 2004.

  1. stck2mlon

    stck2mlon Guest

    Lets say I have a list of options in combobox A

    Test 1
    Test 2
    Test 3

    then I have a list in combobox B

    Cherry
    Apple
    Banana

    and if Test 1 is selected in combobox A then Banana is selected in Combobox B

    very generic...How to? I can't find anything in my book on this.
     
    stck2mlon, May 7, 2004
    #1
  2. stck2mlon

    HJohn Guest

    Here is what you are looking for.

    Private Sub ComboBox1_Change()

    Select Case Me.ComboBox1.Value

    Case "Test1"
    Me.ComboBox2.Text = "Cherry"
    Case "Test2"
    Me.ComboBox2.Text = "Apple"
    Case "Test3"
    Me.ComboBox2.Text = "Banana"
    End Select

    End Sub


    Private Sub UserForm_Initialize()
    Me.ComboBox1.List = Array("Test1", "Test2", "Test3")
    Me.ComboBox2.List = Array("Cherry", "Apple", "Banana")

    End Sub

    Now, I know how difficult it is not to find the answer you are looking for. However, I don't think this is the right place to find answer to elementary questions. Many might consider it a waste of time to answer them. You might not find it in the book you have, but have you tried the library. I found a lot of good tips and tricks on old version Visual Basic books, version 3 and 4. I get them from discount or used book store almost for free. To learn visual basic you don't need the latest flashy book. Hope it helps.
     
    HJohn, May 7, 2004
    #2
  3. stck2mlon

    Tim Badger Guest

    I know how what seems like the simpliest thing can just elude you. Man can
    it be frustrating... happens to me more than i would like to admit. But, as
    I don't know your background, if the case happens to be you are just
    starting out... check out this site...
    http://www.geocities.com/CapeCanaveral/6740/allfiles.htm
    .... it's almost like a collection of pot-luck samples that you can use to
    get familiar with vb. If, on the other hand, it was just one of those
    things... welcome to my world :)

    Tim Badger



    for. However, I don't think this is the right place to find answer to
    elementary questions. Many might consider it a waste of time to answer
    them. You might not find it in the book you have, but have you tried the
    library. I found a lot of good tips and tricks on old version Visual Basic
    books, version 3 and 4. I get them from discount or used book store almost
    for free. To learn visual basic you don't need the latest flashy book.
    Hope it helps.
     
    Tim Badger, May 9, 2004
    #3
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.