How to tell TextBox.Text is null or not

H

Henry Lee

Hi,
I want to tell if the .NET textbox.text control on the web page has been
input or not
So I write
If TextBox.Text <> "" then
.....
End IF
But you know it does not work , the error
"'text' is not a member of 'String'."
How to do it properly ?
Thanks for any input.
Henry
 
K

Karl Seguin

What is TextBox?

it should look osmething like:
<asp:textbox id="Name" runat="server" />

codebehind:

Protected Name as TextBox

sub Page_Load
if not Name.Text is nothing andalso name.Text.Length > 0 then
..
end if
end sub
 
K

Keith Patrick

Or if you're on 2.0,
If Not String.IsNullOrEmpty(Name.Text) Then
....
End If
 

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

No members online now.

Forum statistics

Threads
474,436
Messages
2,571,696
Members
48,796
Latest member
Greg L.
Top