CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2001
    Posts
    33

    Easy Q :Null String

    If txt1.text = Null then
    'do something
    elseif txt1.text <> Null then
    'do another thing
    end if

    I can't check for the null string.



  2. #2
    Join Date
    Nov 2000
    Location
    Tokyo and Memphis
    Posts
    238

    Re: Easy Q :Null String

    if text1.text = "" then
    'do something
    else:
    ' do something else
    end if

    This?

    Phil



  3. #3
    Join Date
    Sep 2000
    Posts
    153

    Re: Easy Q :Null String

    Try this instead:

    if txt1.text = "" Then
    'do something
    else
    'do something else
    end if

    --Joey


  4. #4
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Re: Easy Q :Null String

    First of all, a textbox can't contain null. it contains a nullstring "" or vbNullString (<-- this last one actually is faster then the use of "").

    If you do have a value that can contain Null and you want to test for it, you need to use the IsNull Function. Null doesn't mean empty, it's more like 'i don't know'. For this reason Null isn't equal to Null. Try the following and you will see what I mean.

    If null = null then
    msgbox "null = null"
    else
    msgbox "null <> null"
    End If

    If IsNull(null) then
    msgbox "null is null"
    else
    msgbox "null is Not null"
    End If





    Tom Cannaerts
    [email protected]

    The best way to escape a problem, is to solve it.
    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

  5. #5
    Join Date
    Feb 2001
    Posts
    33

    Re: Easy Q :Null String

    Cakkie, thank you for helping me to solve this problem !


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured