Solved

How to tell if a variable contains an object

Posted on 2006-06-15
2
210 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

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…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

756 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