Re: What is best way to see if an object exist ?

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Ken Halter (Ken_Halter_at_Use_Sparingly_Hotmail.com)
Date: 03/17/04


Date: Wed, 17 Mar 2004 09:39:13 -0800

Note that the tests will never work if you use the following syntax to declare and create
the object variable...

Dim SomeObj As New SomeClass

....but, it works every time with the following

Dim SomeObj As SomeClass
Set SomeObj = New SomeClass

-- 
Ken Halter - MS-MVP-VB - http://www.vbsight.com
Please keep it in the groups..
"Phil Hunt" <phung@ktintl.com> wrote in message
news:ODqhvVEDEHA.1604@TK2MSFTNGP11.phx.gbl...
> thanks, I was trying   obj = nothing
> "Phil Hunt" <phung@ktintl.com> wrote in message
> news:eM4%239uDDEHA.3404@TK2MSFTNGP10.phx.gbl...
> > I use Dim objAny as classAny in my code, sometime i fall into place where
> i
> > check for the object property before it is Set. So is there a standard way
> > to check its existence ?
> > Trap the error or some other way ?
> >
> >
>
>


Relevant Pages

  • Re: Is an object nothing?
    ... Ken Halter wrote: ... > Dim SomeObj As New SomeClass ... It's like a Heisenbug. ...
    (microsoft.public.vb.general.discussion)
  • Re: What is best way to see if an object exist ?
    ... > Note that the tests will never work if you use the following syntax to ... declare and create ... > Dim SomeObj As New SomeClass ...
    (microsoft.public.vb.general.discussion)