Microsoft
Software
Hardware
Network
Question : Check for nulls to stop the error - Nullable object must have a value
In the line of code below I want to check if nothing is being passed to User.longVal to stop the error
"Nullable object must have a value"
User.longVal = (double)CurrentUser.longVa
l;
So if nothing is in the
(double)CurrentUser.longVa
l
I want to set a default value -
Do I use the ?? directive
Answer : Check for nulls to stop the error - Nullable object must have a value
I believe it should be something like (C# only):
1:
User.longVal = (double)CurrentUser.longVal ?? default_value;
Random Solutions
Display a form within a Panel. How to hide caption bar?
Javascript... add onmouseover .... variable not working
Files scp'ed from Unix servers to Win XP (running WinSSHD V5 ) could not be deleted on the PC
C# delete empty rows in excel
Windows Small Business Server 2008 Console Updates
VMWare 4 Error parsing the servers clients.xml file
storing multiple image in one field
Display User Pictures stored in AD (thumbnailPhoto) in Windows 7 and Windows 2008 Logins
Count consecutive values in MS SQL Server 2005
can't find Printer Setup Utility in Mac OS X 10.5.8