Check empty variable. Strange problem. Need Help.

S

Shapper

Hello,

I need to check if a textbox is returning an empty value.
When I use Response.Write(myTextBox.Text) I get the written value.

However, when I use the code:
If myTextBox.Text Is Nothing Then
Response.Write("Empty")
End If

"Empty" doesn't show even if I don't write anything in the text box.
Am I doing something wrong?

Thanks,
Miguel
 
G

gabe garza

You use "Nothing" to see if an object exists or not.
To see if your TextBox has something, check it's Length property. If it's 0
then you don't have anything in the TextBox.
 

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

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top