[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.
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
Re: Question with is " isnothing(TextBox.Text)"