Solved

How to tell if a variable contains an object

Posted on 2006-06-15
2
213 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 18

Accepted Solution

by:
Ravi Singh earned 50 total points
ID: 16912196
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
ID: 16912471
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

630 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