Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Getting selected item from ListBox control
Message
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Titre:
Getting selected item from ListBox control
Versions des environnements
Environment:
C# 1.1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01209799
Message ID:
01209799
Vues:
51
I'm developing a Windows Forms application that includes a ListBox control.

I have created a handler for the Click event.

But, I am not able to get the value of the SelectedItem. Here is the offending line:

string SessDate = (string)(listBox1.SelectedItem);

I get an error message saying "Unable to cast object of type 'System.Data.DataRowView' to type 'System.String'.

When I run under the debugger, I can see this.ListBox and that shows {SelectedItem = "10/25/2002"} which is what I am trying to get.

Help!

Thanks,
Jim
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform