❔ ComboBox | When in ComboBox1 "A" selected then show in combobox2 "B"

Hello everyone, im from Germany so sorry for my bad english. I need "Short"-Help, I´ve got 4 comboBoxes as ja simple Dropdown. Now I want that if i select in comboBox1 "one" thats comboBox2 shows me "Text A, Text B" but if i select "two" in comboBox1 thats comboBox2 shows me "Text C, Text D". Can you help me? Im a bit of tired xd
8 Replies
SWR
SWR9mo ago
You need to add a SelectedIndexChanged event to your first combo box.
nichtfamedominik
and which code i tipe in?
SWR
SWR9mo ago
code that changes the text of the entries in comboBox2
nichtfamedominik
okay mate thanks, very helpful 😅
Anu6is
Anu6is9mo ago
- subscribe to the SelectedIndexChanged event of comboBox1 - in the event handler method for SelectedIndexChanged * Get the conboBox1.SelectedItem * Based on the value of the selected item add the choices to comboBox2 using comboBox2.Items.AddRange
nichtfamedominik
string curItem = comboBox4.SelectedItem.ToString(); int index = comboBox4.FindString("Hamburg"); if (index == -1) comboBox1.Text = "Derzeit keine Einträge vorhanden"; else comboBox1.Text = "Hamburg-Lübeck"; i have that now but it didnt work
Anu6is
Anu6is9mo ago
only the first line of that code matches part of my suggestion 🤔
Accord
Accord9mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.