Click here to Skip to main content
15,891,657 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need to get the selected value from list box : getselectedItem or ListBox.Text doesn't work
Posted

Use ListBox.SelectedValue property
 
Share this answer
 
Comments
Dalek Dave 28-Oct-10 3:46am    
Sometimes they are just too easy! :)
Al-Farooque Shubho 28-Oct-10 4:05am    
Right ;)
Try ((ListBoxItem)listBox1.SelectedValue).Content.ToString()
 
Share this answer
 
string str=listbox1.SelectedItem.ToString();
 
Share this answer
 
use like this ,
string i = ListBox1.SelectedItem.ToString()
 
Share this answer
 
Comments
Tarun.K.S 28-Oct-10 8:53am    
this one also works.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900