Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to take advantage of ListBox.ValueMember
Message
De
29/03/2007 12:53:45
John Baird
Coatesville, Pennsylvanie, États-Unis
 
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Versions des environnements
Environment:
C# 2.0
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01209815
Message ID:
01209897
Vues:
23
Check to see if its null before you use it.



>But, this now leads to another error. When I exit the program, I get the following message:
>
>"Object reference not set to an instance of an object", and the line pointed to is
>
>this.SessionID = (int) listBox1.SelectedValue;
>
>In the debugger's watch list, I can see that SessionID = 76, the last thing I processed. this.listBox1 seems to still exist. But, this.listBox1.SelectedValue is null.
>
>Should I be cleaning up or something to prevent this? Or should I just check for SelectedValue not NULL before I try to use it?
>
>Thanks
>Jim
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform