Get selected item value from listbox -


public void select(int z) {      listbox1.selectedindex = z;      listbox1.selecteditem = listbox1.items[z];                      listboxitem      selecteditem=listbox1.itemcontainergenerator.containerfromitem(this.listbox1.selecteditem)         listboxitem;      selecteditem.focus();  } 

in method i'm trying select element in listbox, reference variable carrying value null returning selection code.

"listbox1.itemcontainergenerator.containerfromitem(this.listbox1.selecteditem) listboxitem;"

i have debugged code , keenly observed values coming listbox1 object, still returning null value.

listboxitem selecteditem = listbox1.itemcontainergenerator.containerfromitem(this.listbox1.selecteditem) listboxitem; textbox1.text = selecteditem.content.tostring(); 

or textbox1.context = selecteditem.content.tostring();

good luck :)


Comments

Popular posts from this blog

Cursor error with postgresql, pgpool and php -

delphi - ESC/P programming! -

c++ - error: use of deleted function -