Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > ASP.NET 3.5 Professionals
|
ASP.NET 3.5 Professionals If you are an experienced ASP.NET programmer, this is the forum for your 3.5 questions. Please also see the Visual Web Developer 2008 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 3.5 Professionals section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 19th, 2009, 02:43 PM
Friend of Wrox
 
Join Date: Apr 2005
Posts: 128
Thanks: 0
Thanked 0 Times in 0 Posts
Default Getting Listbox selected value into a string

Hi All ,

I am trying to store a single selected value of a Listbox into a string but it's giving me exceptions.

I am doing the following:

[code]

string xx=string.Empty;

xx= lstbox1.SelectedValue.ToString();

This is not working. What is the alternate way to do this. ??

Urgent !!! Please help
 
Old October 20th, 2009, 09:30 PM
Authorized User
 
Join Date: Jun 2009
Posts: 18
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Hi,my friend
Yon should code:
Code:
string ss = this.ListBox1.SelectedItem.Text;
and then U will get the selected value of the listbox,I tried,and it worked fine.
Hope useful for U.





Similar Threads
Thread Thread Starter Forum Replies Last Post
ListBox selected item retrieval help JLynn Beginning VB 6 4 October 23rd, 2009 01:01 AM
ListBox not showing correct selected value Shokwave ASP.NET 2.0 Basics 4 June 4th, 2007 08:23 AM
Get selected values from ListBox to DetailsView gerten ASP.NET 2.0 Professional 0 October 12th, 2006 01:21 PM
Set Listbox Selected property DaDeViL VB How-To 7 October 4th, 2006 04:04 PM
How to get selected Item from Listbox? Iceman571 ADO.NET 1 March 25th, 2004 06:33 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.