-
test for input in ASP page
I have some simple code:
sub tbMessage_Change (sender as Object, E as EventArgs)
lblMessage.Text = "Hello " + tbMessage.Text
end sub
I want to evaluate the tbMessage.Text to see if there is any content or
empty in the submit. How do I do that. In VFP
iif(empty(tbMessage.Text),"","Hello ") would be the code. What is the VB
equiilvant?
TIA
__Stephen
-
Re: test for input in ASP page
> I want to evaluate the tbMessage.Text to see if there
> is any content or empty in the submit. How do I do that?
Stephen:
Sub tbMessage_Change (sender as Object, E as EventArgs)
Dim sText As String = tbMessage.Text
If Len(sText) Then
sText = "Hello " & sText
End If
lblMessage.Text = sText
End Sub
---
Phil Weber
-
Re: test for input in ASP page
Thanks.
__Stephen
"Phil Weber" <pweber@nospam.fawcette.com> wrote in message
news:3c65a336@10.1.10.29...
> > I want to evaluate the tbMessage.Text to see if there
> > is any content or empty in the submit. How do I do that?
>
> Stephen:
>
> Sub tbMessage_Change (sender as Object, E as EventArgs)
> Dim sText As String = tbMessage.Text
> If Len(sText) Then
> sText = "Hello " & sText
> End If
> lblMessage.Text = sText
> End Sub
>
> ---
> Phil Weber
>
>
-
Re: test for input in ASP page
There is an alternative syntax in VB.NET too,
VB6: len(sText)
VB.NET: sText.length = 0
Personally I prefer to be more explicit and would rather see either
if len(sText)= 0 then or
if sText.length = 0 then
I'm not sure which of the two is faster, but the VB.NET syntax will be the
same in C# too (well the sText.length bit anyway).
Garry Mc
"Phil Weber" <pweber@nospam.fawcette.com> wrote:
> > I want to evaluate the tbMessage.Text to see if there
> > is any content or empty in the submit. How do I do that?
>
>Stephen:
>
> Sub tbMessage_Change (sender as Object, E as EventArgs)
> Dim sText As String = tbMessage.Text
> If Len(sText) Then
> sText = "Hello " & sText
> End If
> lblMessage.Text = sText
> End Sub
>
>---
>Phil Weber
>
>
-
Re: test for input in ASP page
I'd rather be current in my code. Is there a way to see if blanks are all
that are in the string? Or do I have to create my own class for an empty()
function that parses through the string?
Thanks for the object reference.
__Stephen
"Garry Mc" <garrymc@spam.itswebservices.com> wrote in message
news:3c669ec1$1@10.1.10.29...
>
> There is an alternative syntax in VB.NET too,
>
> VB6: len(sText)
> VB.NET: sText.length = 0
>
> Personally I prefer to be more explicit and would rather see either
> if len(sText)= 0 then or
> if sText.length = 0 then
>
> I'm not sure which of the two is faster, but the VB.NET syntax will be the
> same in C# too (well the sText.length bit anyway).
>
> Garry Mc
>
> "Phil Weber" <pweber@nospam.fawcette.com> wrote:
> > > I want to evaluate the tbMessage.Text to see if there
> > > is any content or empty in the submit. How do I do that?
> >
> >Stephen:
> >
> > Sub tbMessage_Change (sender as Object, E as EventArgs)
> > Dim sText As String = tbMessage.Text
> > If Len(sText) Then
> > sText = "Hello " & sText
> > End If
> > lblMessage.Text = sText
> > End Sub
> >
> >---
> >Phil Weber
> >
> >
>
-
Re: test for input in ASP page
> Is there a way to see if blanks are all that are
> in the string?
Stephen:
Sub tbMessage_Change (sender as Object, E as EventArgs)
Dim sText As String = Trim(tbMessage.Text)
If Len(sText) Then
sText = "Hello " & sText
End If
lblMessage.Text = sText
End Sub
---
Phil Weber
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
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks