How to Use Isnullorempty in Vb. Net?
Why Doesn't the Following Compile in Vb. Net? Dim strTest as String If (Strtest. Isnullorempty) Then Messagebox. Show("Null or Empty") End If 1 3 Answers...
Why doesn't the following compile in VB.NET?
Dim strTest As String
If (strTest.IsNullOrEmpty) Then
MessageBox.Show("NULL OR EMPTY")
End if
3 Answers
IsNullOrEmpty is 'shared' so you should use it that way:
If String.IsNullOrEmpty(strTest) Then
You can actually just compare to an empty string:
If strTest = "" Then
MessageBox.Show("NULL OR EMPTY")
End If
String.IsNullOrEmpty is a shared (or static, in C#) method.
Dim strTest As String
If (String.IsNullOrEmpty(strTest)) Then
MessageBox.Show("NULL OR EMPTY")
End if