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

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -