Re: testing whether an object exists

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Gale Green (gale_at_databeat.fsnet.co.uk)
Date: 05/24/04


Date: Mon, 24 May 2004 17:21:51 +0100

On Mon, 24 May 2004 18:17:07 +0200, "Peter" <-> wrote:

>Hi
>
>I thought that I can do the following to test whether an object still
>exists:
>if myopject<>Nothing then...
>But VB gives me an error on this.
>Do I need to make error trapping to test whether an object exists or are
>there other ways???

If MyObject Is Nothing Then

or

If Not (MyObject Is Nothing) Then

The parentheses are optional but I always use them when I use "Not".

Gale.