B
Bill Dee
In C# this line compiles and works fine:
if (Request.Params["something"] != null)
But when trying to convert this to VB.NET and changing it to:
if (Request.Params["something"] <> Nothing)
I get the following error: Compiler Error Message: BC30311: Value of type
'System.Collections.Specialized.NameValueCollection' cannot be converted to
'Boolean'
Anyone know why this works in C# but not VB? How do I fix this?
Basically I do not care what the value of the param is, I just want to know
whether its set to anything or not. If I try and check its value without
testing it for null, then I will receive an error from trying to access a
null object. So it seems I need a way to check for null in the first place,
but cannot figure out how to do this in VB.NET. Any ideas? Thank you.
if (Request.Params["something"] != null)
But when trying to convert this to VB.NET and changing it to:
if (Request.Params["something"] <> Nothing)
I get the following error: Compiler Error Message: BC30311: Value of type
'System.Collections.Specialized.NameValueCollection' cannot be converted to
'Boolean'
Anyone know why this works in C# but not VB? How do I fix this?
Basically I do not care what the value of the param is, I just want to know
whether its set to anything or not. If I try and check its value without
testing it for null, then I will receive an error from trying to access a
null object. So it seems I need a way to check for null in the first place,
but cannot figure out how to do this in VB.NET. Any ideas? Thank you.