By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,932 Members | 1,462 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,932 IT Pros & Developers. It's quick & easy.

Test If HttpContext.Current.Application("var") exists (vb.net)

P: n/a
gn
I am a VB.Net newbie and have tried to search for this answer without
success - What is the exact syntax to test if
HttpContext.Current.Application("var") exists in vb.net

I have tried:

If (HttpContext.Current.Application("var").ToString) <> "" Then

That gives me System.NullReferenceException: Object reference not set
to an instance of an object Error, I suspect because I am trying to
convert nothing into a string??

If HttpContext.Current.Application("var") is null then

Didn't like that either, syntax checker said I should use system.DBnull
since 'null' is no longer supported??

I am sure I am missing something very simple, could someone please give
me a nudge in the right direction?

Thanks

Nov 19 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Tim
Hello,
Check if it is nothing like so:

HttpContext.Current.Application.Item("MyVal") Is Nothing

Tim Stall
http://timstall.dotnetdevelopersjournal.com/
"gn@dana.ucc.nau.edu" wrote:
I am a VB.Net newbie and have tried to search for this answer without
success - What is the exact syntax to test if
HttpContext.Current.Application("var") exists in vb.net

I have tried:

If (HttpContext.Current.Application("var").ToString) <> "" Then

That gives me System.NullReferenceException: Object reference not set
to an instance of an object Error, I suspect because I am trying to
convert nothing into a string??

If HttpContext.Current.Application("var") is null then

Didn't like that either, syntax checker said I should use system.DBnull
since 'null' is no longer supported??

I am sure I am missing something very simple, could someone please give
me a nudge in the right direction?

Thanks

Nov 19 '05 #2

P: n/a
Duh!

I think I am in need of a rest, I knew that!
Thank you for saving me from myself

Nov 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.