Confusion on nothing

  • Thread starter Thread starter John
  • Start date Start date
J

John

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
 
Use the "Is" operator
If (newUser is Nothing) Then

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

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top