Re: Checking for A Blank String
- From: Göran Andersson <guffa@xxxxxxxxx>
- Date: Sat, 10 Mar 2007 03:03:39 +0100
Herfried K. Wagner [MVP] wrote:
Göran,
"Göran Andersson" <guffa@xxxxxxxxx> schrieb:If you want to check if your variable is not 'Nothing' and does not
contain an empty string:
\\\
If Len(s) > 0 Then
...
End If
///
This is my recommended way too. For all the new features and functionality offered in .NET, I'll still go for good ol' Len() every time.
The Len function is just a wrapper for the String.Length method.
If s.Length > 0 Then
...
End If
No, it's more than that. It will return 0 if the value passed to it is 'Nothing'. The code you posted would throw a 'NullReferenceException' in this case.
Yes, ok, it's almost only a wrapper.
--
Göran Andersson
_____
http://www.guffa.com
.
- Follow-Ups:
- Re: Checking for A Blank String
- From: \(O\)enone
- Re: Checking for A Blank String
- References:
- Re: Checking for A Blank String
- From: Herfried K. Wagner [MVP]
- Re: Checking for A Blank String
- From: \(O\)enone
- Re: Checking for A Blank String
- From: Göran Andersson
- Re: Checking for A Blank String
- From: Herfried K. Wagner [MVP]
- Re: Checking for A Blank String
- Prev by Date: Re: Bind combobox to sql statement result in VB2005
- Next by Date: Re: Bind combobox to sql statement result in VB2005
- Previous by thread: Re: Checking for A Blank String
- Next by thread: Re: Checking for A Blank String
- Index(es):
Relevant Pages
|
Loading