[Is nothing ] questiom

A

Agnes

I need to detect an object first. If it is not nothing... clear the dataset.
However, Does there is any "is not nothing" function ?? Thanks


If Me.pObjdaResultSet Is Nothing Then
Else
dsMasterCompany.Clear()
endif
 
S

Stephany Young

If Not <object> Is Nothing

or

If Not [Microsoft.VisualBasic.]IsNothing(<object>)
 
C

Cor Ligthert

Agnes,

I wish that there was a Is Something Question, however that is not done by
Microsoft.

(Is Nothing is nothing else than testing against a non referenced object,
very easy to do even by you).

Something as
dim ObjectNothing as Object
dim myOjbect as Object
If Not myObject Is ObjectNothing then

And therefore what is done by Microsoft is the same however there is already
an empty object "Nothing" so you can use that.

And therefore the answer is.

If Not myObject Is Nothing then

In the next VB version there will be something weird as

If Not myObject IsNot Nothing then

Don't ask me if that means if it is Nothing or Something.

(Probably it will work accoording the English language behaviour, which is
algabraic correct, however there are a lot of natural languages, which have
another behaviour, so it can become real weird situations)

I hope this helps?

Cor
 
M

Mick Doherty

Hi Cor,
In the next VB version there will be something weird as

If Not myObject IsNot Nothing then

Don't ask me if that means if it is Nothing or Something.

The Not's will cancel each other out, so that statement would be equivalent
to

If myObject Is Nothing Then
 
C

Cor Ligthert

Mick,

I asume you know that I did knew that, however I find it a weird instruction
and that was what I tried to tell with this.

No problem just laughing

:)

Cor
 
J

J L

Why not this?

If IsNothing(Me.pObjdaResultSet) then
Else
dsMasterCompany.Clear()
End IF

John
 
A

Alexandre Moura

The idea is that you either have:
If myObject IsNot Nothing then
when you want to do something when an object was initialized, or:
If myObject Is Nothing then
When you want to do something when the object wasn't initialized, but you'd probably not mix the not and isnot together (not that you can't, just that it makes
for some tough to read code)

hope that helps,
Alex, MS VB QA


--------------------
From: "Mick Doherty" <EXCHANGE#[email protected].[mdaudi100#ntlworld.com]>
References: <[email protected]> <[email protected]>
Subject: Re: [Is nothing ] questiom
Date: Mon, 7 Mar 2005 11:21:09 -0000
Lines: 19
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2527
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527
X-RFC2646: Format=Flowed; Response
Message-ID: <[email protected]>
Newsgroups: microsoft.public.dotnet.languages.vb
NNTP-Posting-Host: cpc1-colc2-6-0-cust138.colc.cable.ntl.com 81.101.137.138
Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09.phx.gbl
Xref: TK2MSFTNGXA02.phx.gbl microsoft.public.dotnet.languages.vb:263676
X-Tomcat-NG: microsoft.public.dotnet.languages.vb

Hi Cor,
In the next VB version there will be something weird as

If Not myObject IsNot Nothing then

Don't ask me if that means if it is Nothing or Something.

The Not's will cancel each other out, so that statement would be equivalent
to

If myObject Is Nothing Then
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top