Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   Confusion on nothing (http://www.velocityreviews.com/forums/t367133-confusion-on-nothing.html)

John 08-28-2006 02:06 PM

Confusion on nothing
 
Hi

I am confused over how to check for nulls (Nothing in vb.net?). For instance
I am trying to create user in my vb.net/asp.net app as below;

Dim newUser As MembershipUser = Membership.CreateUser(Username, Password,
Email, passwordQuestion, passwordAnswer, True, status)
If (newUser = Nothing) Then

But I get an "Operator '=' is not defined for types
'System.Web.Security.MembershipUser' and
'System.Web.Security.MembershipUser'. " error on the second line above. What
is the correct method to check for nothing in vb.net?

Thanks

Regards



Van den Driessche Willy 08-28-2006 02:07 PM

Re: Confusion on nothing
 
Use the "Is" operator
If (newUser is Nothing) Then

or the related (VS2005)
If (newUser isNot Nothing) Then


"John" <John@nospam.infovis.co.uk> wrote in message
news:OY0xnsqyGHA.772@TK2MSFTNGP05.phx.gbl...
> Hi
>
> I am confused over how to check for nulls (Nothing in vb.net?). For

instance
> I am trying to create user in my vb.net/asp.net app as below;
>
> Dim newUser As MembershipUser = Membership.CreateUser(Username, Password,
> Email, passwordQuestion, passwordAnswer, True, status)
> If (newUser = Nothing) Then
>
> But I get an "Operator '=' is not defined for types
> 'System.Web.Security.MembershipUser' and
> 'System.Web.Security.MembershipUser'. " error on the second line above.

What
> is the correct method to check for nothing in vb.net?
>
> Thanks
>
> Regards
>
>




Karl Seguin [MVP] 08-28-2006 02:13 PM

Re: Confusion on nothing
 
use the "is" keyword in vb.net

if user is nothing then


Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/


"John" <John@nospam.infovis.co.uk> wrote in message
news:OY0xnsqyGHA.772@TK2MSFTNGP05.phx.gbl...
> Hi
>
> I am confused over how to check for nulls (Nothing in vb.net?). For
> instance I am trying to create user in my vb.net/asp.net app as below;
>
> Dim newUser As MembershipUser = Membership.CreateUser(Username, Password,
> Email, passwordQuestion, passwordAnswer, True, status)
> If (newUser = Nothing) Then
>
> But I get an "Operator '=' is not defined for types
> 'System.Web.Security.MembershipUser' and
> 'System.Web.Security.MembershipUser'. " error on the second line above.
> What is the correct method to check for nothing in vb.net?
>
> Thanks
>
> Regards
>
>





All times are GMT. The time now is 04:05 PM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57