N
Neville Lang
Hi all,
I am having a memory blank at the moment. I have been writing in C# for a
number of years and now need to do something in VB.NET, so forgive me such a
primitive question.
In C#, I test whether a string has a value or not by the following syntax:
if (thisString.Trim() == "")
{
// if true
something()
}
else
{
// if false
somethingelse()
}
Now, in VB.NET an equivalent does not seem to work:
If thisString.Trim() = "" Then
' if true
something()
Else
' if false
somethingelse()
End If
I cannot get past a False return for the VB comparison. What is the best
method for testing whether a string is empty or null?
Regards,
Neville Lang
I am having a memory blank at the moment. I have been writing in C# for a
number of years and now need to do something in VB.NET, so forgive me such a
primitive question.
In C#, I test whether a string has a value or not by the following syntax:
if (thisString.Trim() == "")
{
// if true
something()
}
else
{
// if false
somethingelse()
}
Now, in VB.NET an equivalent does not seem to work:
If thisString.Trim() = "" Then
' if true
something()
Else
' if false
somethingelse()
End If
I cannot get past a False return for the VB comparison. What is the best
method for testing whether a string is empty or null?
Regards,
Neville Lang