Solved

How to tell if a variable contains an object

Posted on 2006-06-15
2
206 Views
Last Modified: 2012-05-05
I've created a form and stored it in a variable, however i need to be able to tell if the form has already been created and stored so that i don't do it again.

How do i do it? There used to be IsObject in VB6.
0
Comment
Question by:James_Wyatt
2 Comments
 
LVL 18

Accepted Solution

by:
Ravi Singh earned 50 total points
Comment Utility
When a variable isnt referencing anything its usually just a null, have you tried comparing against the null?

if (FormObject == null)
      //FormObject not initialised
else
     //FormObject was initialised
0
 
LVL 1

Author Comment

by:James_Wyatt
Comment Utility
Cheers i narrowed it down to

if (myResults == null || myResults.IsDisposed)

had to add is disposed incase someone had closed the form.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video discusses moving either the default database or any database to a new volume.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now