Confusion on nothing

Discussion in 'ASP .Net' started by John, Aug 28, 2006.

  1. John

    John Guest

    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
    John, Aug 28, 2006
    #1
    1. Advertising

  2. Use the "Is" operator
    If (newUser is Nothing) Then

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


    "John" <> wrote in message
    news:...
    > 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, Aug 28, 2006
    #2
    1. Advertising

  3. use the "is" keyword in vb.net

    if user is nothing then


    Karl

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


    "John" <> wrote in message
    news:...
    > 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], Aug 28, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark Kamoski

    setting to Nothing

    Mark Kamoski, Aug 7, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    1,076
    Robert Jacobson
    Aug 7, 2003
  2. Claudio Biagioli
    Replies:
    2
    Views:
    4,541
    William F. Robertson, Jr.
    Jun 25, 2003
  3. Hector Bejarano

    Request.UrlReferrer is nothing

    Hector Bejarano, Jul 8, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    822
    Hector Bejarano
    Jul 8, 2003
  4. Sven Nilsen

    Re: Is Nothing?

    Sven Nilsen, Jul 16, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    425
    Sven Nilsen
    Jul 16, 2003
  5. Devin Jeanpierre
    Replies:
    2
    Views:
    427
    Devin Jeanpierre
    Feb 14, 2012
Loading...

Share This Page