|
-
Mar 15th, 2004, 11:53 AM
#1
Thread Starter
Lively Member
To check an empty string into a variable
How can I check an empty string into a variable?
For instance, I want to check if the 'Var2' is equal to empty string (I mean nothing):
Code:
If ((Var1 = 7) AND (Var2 = "")) Then
value.IsValid = False
Exit Sub
End If
In this way (Var 2= "") doesn' t run
Thanks,
Cesar
-
Mar 15th, 2004, 12:30 PM
#2
Member
You could do Len(var2) = 0
Frank
-
Mar 15th, 2004, 12:53 PM
#3
Sleep mode
.Length method of string type is the pure .NET way if you want to do it that way . Len is imported from Microsoft.VisualBasic which is only for compatiblity support .
-
Mar 15th, 2004, 12:54 PM
#4
Thread Starter
Lively Member
It does the same . I don' t understand why? The 'Var2' is a text field in an aspx web form page.
If I put this, runs:
Code:
...
If ((Var1 = 7) AND (Var2 = 2)) Then
value.IsValid = False
Exit Sub
End If
...
But I want to check an empty string to 'Var2'...
Any suggestions?
-
Mar 15th, 2004, 12:56 PM
#5
Member
thanks Pirate.
Didn't know that, I will use .length instead.
Frank
-
Mar 15th, 2004, 01:03 PM
#6
Sleep mode
I don't understand this neither , try removing the round brackets and replace 'And' for 'AndAlso' . See if this makes any difference .
-
Mar 15th, 2004, 07:22 PM
#7
Thread Starter
Lively Member
It does the same.. The normal way is (Var2 = "") when the object that represents 'Var2' is an asp.net text box?
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
|
Click Here to Expand Forum to Full Width
|