Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Getting selected item from ListBox control
Message
De
29/03/2007 11:44:19
 
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Versions des environnements
Environment:
C# 1.1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01209799
Message ID:
01209826
Vues:
15
Jim,

Perhaps this one works better.
string SessDate = this.listBox1.SelectedItem.ToString();
HTH

>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
robert.oh.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform