How do I check if a GUID is nothing or null?

Posted on 2007-07-19
Last Modified: 2008-02-01
How do I check if a GUID is nothing or null?
Is there a built in function lfor this?
Question by:mattphung
    LVL 15

    Accepted Solution

    just use the usual check for nothing/null

    c#: if (objGUID == null)
    vb: if IsNothing(objGUID) then

    Author Comment

    i tried:
    if objGUID = nothing then
    I get an error message "=" is not defined for type "system.GUID"

    why does " Isnothing()" works but "= nothing" doesn't?
    LVL 15

    Expert Comment

    in VB.NET you can't compare an object ot nothing like that. You should also be able to use

    if objGUID is nothing then

    but the same applies, you cant use =nothing like you can use == null in c#
    LVL 96

    Expert Comment

    by:Bob Learned
       if (guidVariable == Guid.Empty)

      If guidVariable.Equals(Guid.Empty) Then


    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!

    Join & Write a Comment

    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 …
    Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    728 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

    18 Experts available now in Live!

    Get 1:1 Help Now