c# - How do you get the text from a listbox by index? -
i trying text entry in winforms listbox index, seem stumped. logical thing can think of is:
listbox.items[index].tostring
but not return desired result.
does know how this?
what have in listbox?
if there string values in listbox, code correct except missing braces:
string value = listbox.items[index].tostring();
if things in listbox sort of object, may need override tostring() desired result, or cast thing out of listbox desired type , access appropriate property.
example:
myclass = (myclass)listbox.items[index]; string value = my.somepropertyofmyclass;
Comments
Post a Comment