Results 1 to 5 of 5

Thread: combobox to Listbox

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2005
    Location
    London
    Posts
    38

    combobox to Listbox

    I`ve got a combobox with 10 item and a list box to view 2 item and for each selected item in combobox, I want the listbox view 2 item specified by code.

    for example

    if combobox1.text = "item1" then
    listbox1.items.add("aaa" & "bbb")

    something like this but I could`t do this, thanks for your help.

    Oz

  2. #2
    Frenzied Member Phill64's Avatar
    Join Date
    Jul 2005
    Location
    Queensland, Australia
    Posts
    1,201

    Re: combobox to Listbox

    Quote Originally Posted by talentedbro
    I`ve got a combobox with 10 item and a list box to view 2 item and for each selected item in combobox, I want the listbox view 2 item specified by code.

    for example

    if combobox1.text = "item1" then
    listbox1.items.add("aaa" & "bbb")

    something like this but I could`t do this, thanks for your help.

    Oz
    why does this not work? could you be more specific, because it should be as simple as this:

    VB Code:
    1. if combobox1.text = "item1" then
    2.   listbox1.items.clear()
    3.   listbox1.items.add("aaa")
    4.   listbox1.items.add("bbb")
    5. end if

    However, you could make this more dynamic using arraylists.

  3. #3

    Thread Starter
    Member
    Join Date
    Jul 2005
    Location
    London
    Posts
    38

    Re: combobox to Listbox

    If I write this code inside of a button click, it works properly but I want that by choosing the items in the combobox, listbox shows the result directly and I don`t know why its not working.

  4. #4
    Fanatic Member uniquegodwin's Avatar
    Join Date
    Jul 2005
    Location
    Chennai,India
    Posts
    694

    Re: combobox to Listbox

    Hi..
    Maybe you could try using something like..
    VB Code:
    1. button1.performclick()
    Godwin

    Help someone else with what someone helped you!

  5. #5
    Lively Member SonicBoomAu's Avatar
    Join Date
    Aug 2004
    Posts
    78

    Re: combobox to Listbox

    You could always use the combobox's follow events

    SelectedValueChanged
    Validating
    LostFocus

    Considering that you want it to change the listbox's items. I would be more inclined to use the SelectedValueChanged event.

    Hope this helps

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