|
-
Jan 13th, 2007, 12:55 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Question with is " isnothing(TextBox.Text)"
Hi
I am trying to query when a textbox is nothing, but it doesn´t seem to work, and I can´t see nothing wrong with it,the code:
VB Code:
If Not IsNothing(TextBox1.Text) Then
do sth
end if
I have a textbox which I leave empty. "If not isnothing(textbox.text)" still evaluates to true, so runs the code in "do sth", when I think it should ignore the "do sth " code.
I have run this in debug mode, and the textbox has the value of texbox1.text ="" , so the textbox is actually nothing.
What is going on here?
Thanks.
-
Jan 13th, 2007, 01:24 PM
#2
Re: Question with is " isnothing(TextBox.Text)"
No, "Nothing" is the VB equivalent to null in C#/C++/Java - that statement is checking for a null value. As the .Text property will not return a null value, the "IsNothing" call will always evaluate to true.
Your code should look like:
Code:
If TextBox1.Text.Length > 0 Then
''' Your code here.
End If
-
Jan 13th, 2007, 01:46 PM
#3
Thread Starter
Hyperactive Member
Re: Question with is " isnothing(TextBox.Text)"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|