Link to home
Start Free TrialLog in
Avatar of nolubabalo dywili
nolubabalo dywili

asked on

how do i code for one of the items in a combobox? i want to select that item then it takes me to a new form.

i have multiple options on my combobox and i want, if someone chooses one, then it takes the person on the for suitable for that option.
Avatar of lapatiya
lapatiya

which programming language? to give you an idea, you need to write an event for item selection in combobox, inside that even you need to write your conditions as bellow. so that once you select the item in combobox, the event will trigger and will process the instructions according to the selection option.

it will be like this;

Sub combobox_Click ()
       
        select case combobox.text
                    case "Food"
                              frameFood.open

                    case "drink"
                              frameDrink.open
        End Case
       
End Sub
Avatar of sarabande
you may have an array with the persons:

  string[] array = { "John", "Mary", "Bob", "Ann" };

Open in new window


one for each option in the combobox.

if the user selects an option just take the corresponding item from array.

int rowSelected = combobox.GetSelection();
string personSelected;
if (rowSelected >= 0)
{
    personSelected = array[rowSelected];
}

Open in new window


Sara
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.