When you think ASP, think...
Recent Articles
All Articles
ASP.NET Articles
ASPFAQs.com
Message Board
Related Web Technologies
User Tips!
Coding Tips

Sections:
Sample Chapters
Commonly Asked Message Board Questions
JavaScript Tutorials
MSDN Communities Hub
Official Docs
Security
Stump the SQL Guru!
XML Info
Information:
Feedback
Author an Article
ASP ASP.NET ASP FAQs Message Board Feedback
Print this page.
Published: Tuesday, March 16, 1999

Poor Man's IsNull
By Tim Sullivan


If all you want to see is if the variable is "blank", try using this nifty function instead of messing around with "IsNull".

- continued -

function PoorMansIsNull(str) Dim blankStr blankStr = trim("" & str) if blankStr = "" then PoorMansIsNull = True else PoorMansIsNull = False end if end function

The ("" & ) before the request variable forces VB to convert NULLS to blank strings. Maybe a little more overhead, but much easier to code and understand. You can use this nifty little function to determine if form fields are blank or not. For example, if you wanted to tell if the user entered his or her name in a field in a form, you could write the following code:

If PoorMansIsNull(Request("txtName")) then
	Response.Write("You didn't enter your name!")
else
	Response.Write("Thanks for entering your name.")
end if

Enjoy!


ASP.NET [1.x] [2.0] | ASPMessageboard.com | ASPFAQs.com | Advertise | Feedback | Author an Article