Geeks With Blogs

News My Blog has been MOVED to
Michael Freidgeim's OLD Blog My Blog has been MOVED to

I've got a compiler error

 Compiler Error Message: BC30452: Operator '<>' is not defined for types 'BaseResultItemsListUsc' and 'BaseResultItemsListUsc'.

If listResults <> Nothing Then
End If

Of course, the correct code should be
If listResults isNot Nothing Then
If Not (listResults is Nothing) Then
If Not IsNothing(listResults) Then

I made a search that there are a few other places where the <> Nothing  was used e.g.

If Request.QueryString("Field") <> Nothing then

dim r as DataRow
If r(x) <> "" And r(x) <> Nothing Then

It seems that compiler doesn't report “ <> Nothing“ for Object type, but reports errors for strong typed varables.

Posted on Monday, July 24, 2006 8:54 AM .Net Framework | Back to top

Comments on this post: VB.Net compiler error when compare with Nothing.

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Michael Freidgeim | Powered by: