Click to See Complete Forum and Search --> : Easy Q :Null String


Blue Sky
March 26th, 2001, 09:34 PM
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.

phil m
March 26th, 2001, 11:30 PM
if text1.text = "" then
'do something
else:
' do something else
end if

This?

Phil

FiendSC
March 26th, 2001, 11:30 PM
Try this instead:

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

--Joey

Cakkie
March 27th, 2001, 01:15 AM
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
slisse@planetinternet.be

The best way to escape a problem, is to solve it.

Blue Sky
March 27th, 2001, 04:21 AM
Cakkie, thank you for helping me to solve this problem !