c# - how to select latest item in the listbox -



c# - how to select latest item in the listbox -

i using winform , c#,i adding items in list box

5<-----focus on first element 8 9 99 100

default focus coming on first element(like 5). trying if adding new element in list box 77 focus on 77

5 8 9 77 <---here m trying focus 99 100

i tried not working

listbox1.selectedindex = listbox1.items.count - 1; listbox1.focus();

thanks

you set focus whenever add together new item listbox follows,

listbox1.items.add(77); listbox1.setselected(listbox1.items.indexof(77), true);

c# winforms

Comments

Popular posts from this blog

c - Compilation of a code: unkown type name string -

java - Bypassing "final local variable defined in an enclosing type" -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -