How to add items without repeating

Posted on 2006-05-24
Last Modified: 2008-02-01
Hello Experts,

I Have something like

<Object Runat="Server" Scope="application" ID="dOnlineUsers" ProgID="Scripting.Dictionary" VIEWASTEXT></Object>

dOnlineUsers.Add Session.SessionID, sUserInfo

but I dont want to add if an item is already added.

Thanks in advance

Question by:wildcard76
    LVL 3

    Author Comment

    no answers yet
    so increasing points
    LVL 7

    Accepted Solution


    Hi, not sure if this is what you are after, but, assuming this is a true dictionary object, then you need to use the

    .Exists(key) to test to see if the key is already there...

    So you would use it like:

    If dOnlineUsers.Exists(Session.SessionID) = False Then
       dOnlineUsers.Add Session.SessionID, sUserInfo
    End If

    Hope that helps
    LVL 3

    Author Comment

    yes that does the trick :)

    thanks and regards


    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Suggested Solutions

    I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
    This demonstration started out as a follow up to some recently posted questions on the subject of logging in: and…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    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…

    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

    20 Experts available now in Live!

    Get 1:1 Help Now