There is no IsNull function in VB.Net. Instead, it has other functions, such as String.IsNullOrEmpty function and String.Empty property, etc. To determine if a string is empty or not.
IsNull in VB6 / VBA means that the expression does not contain valid data. You get False in vb6 because you initialized strTest . It contains an empty string. You can also see THIS
Vb6
IsNull(Trim(strTest))
In VB.Net, IsNullOrEmpty Indicates whether the specified string is Nothing or the string Empty .
Vb.net
If String.IsNullOrEmpty(strTest.Trim) Then DoWhatever If strTest.Trim = String.Empty Then DoWhatever If strTest.Trim = "" Then DoWhatever '<~~ Same in VB6 as well If String.IsNullOrWhiteSpace(strTest) Then DoWhatever '<~~ VB2010 onwards only
All this will return True in VB.Net, because the string IS EMPTY. You might want to see THIS
If your string value is all spaces, either use strTest.Trim() before using the first three parameters, or use the 4th option, which checks if it is nothing, or an empty string or all spaces.
Siddharth route
source share