Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to take advantage of ListBox.ValueMember
Message
From
29/03/2007 12:53:45
John Baird
Coatesville, Pennsylvania, United States
 
General information
Forum:
ASP.NET
Category:
Forms
Environment versions
Environment:
C# 2.0
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01209815
Message ID:
01209897
Views:
24
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
Previous
Reply
Map
View

Click here to load this message in the networking platform