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

Sample Chapters
Commonly Asked Message Board Questions
JavaScript Tutorials
MSDN Communities Hub
Official Docs
Stump the SQL Guru!
XML Info
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!")
	Response.Write("Thanks for entering your name.")
end if


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