Angela4eva
asked on
Vb.net two dropdown one function
Protected Sub ddlManagers_SelectedIndexC hanged(sen der As Object, e As EventArgs) Handles ddlManagersTop.SelectedInd exChanged, ddlManagersBottom.Selected IndexChang ed
dosomething(ddlManagersTop .SelectedI tem.Text)
End Sub
I have one function for two dropdown selected index changed events,
Now above code workd only if the selection in Top dropdown changes but not working for the botton drop down.
How can I make it work for both the dropdowns/
dosomething(ddlManagersTop
End Sub
I have one function for two dropdown selected index changed events,
Now above code workd only if the selection in Top dropdown changes but not working for the botton drop down.
How can I make it work for both the dropdowns/
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Do both dropdowns set the dropdownstyle to dropdownList. If the user can type free text into the box then sometimes the index does not change and hence the event does not trigger.
I'm guessing the above should be ComboBox rather than DropDownList--it's been so long since I've done WinForms. The concept is the same; change the class accordingly. = )
add
Dim ddl As <your control type> = DirectCast(sender, <your control type> )
dosomething(ddl.selectedit em.text)
<your control type> is whatever control you want/need. i.e. button, combobox, etc.
Dim ddl As <your control type> = DirectCast(sender, <your control type> )
dosomething(ddl.selectedit
<your control type> is whatever control you want/need. i.e. button, combobox, etc.