c# - Is there a way to make a drop down menu like this? -
is there know how make drop down menu this?
i put in if me:
private void richtextbox1_textchanged(object sender, eventargs e) { //in here }
yes , can use listbox
control.
or
you can use combobox
control setting dropdownstyle
property simple
.
edit:
if want search string listbox , select item if matching
you need have textbox receive serach string input.
you need handle textbox key_down event handler start searching.
note: in below code have started searching when user enters enter
key after entering input search string.
try this:
private void textbox1_keydown(object sender, keyeventargs e) { if (e.keycode == keys.enter) { var itemsearched = textbox1.text; int itemcount = 0; foreach (var item in listbox1.items) { if (item.tostring().indexof(itemsearched,stringcomparison.invariantcultureignorecase)!=-1) { listbox1.selectedindex = itemcount; break; } itemcount++; } } }
Comments
Post a Comment