"If {AdoConnection} IsNot Nothing Then" vs "If Not {AdoConnection} Is Nothing Then"

Posted on 2008-11-10
Last Modified: 2012-06-27
Is one better to use than the other?  Is there another way of checking if something (in this case, an ADO Connection object) is nothing.

In VB6, I would write:

If Not {AdoConnection} Is Nothing Then
End If

In VB.NET, neither the above nor the following generate an error:

If {AdoConnection} IsNot Nothing Then
End If

Question by:CarlaGibson
    LVL 142

    Expert Comment

    by:Guy Hengel [angelIII / a3]
    what about
    If Not IsNothing({AdoConnection}) Then
    End If

    Open in new window


    Author Comment

    Does it matter which way is used?  They all give the same results.  Is it just personal preference or is there a reason to use one over the other?
    LVL 142

    Accepted Solution

    > They all give the same results.
    the only difference could then be performance, right?!

    in which case, IsNothing is a function call, which will have a slight overhead over the other methods.

    Author Closing Comment


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Article by: Kraeven
    Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
    It’s quite interesting for me as I worked with Excel using for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    779 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

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now