Opposite Value of What CBool(Variable) evaluates to

Posted on 2008-11-19
Last Modified: 2012-06-22
How do i programmtically, in one line get the opposite value of what cbool is evaluating to.  So if Cbool(Var) = True, how would I write the code so that the value would be false.

An example of what i'm doing might help:
Application("VendorVisible") = True

ddlVendorID.visible = Cbool(Application("VendorVisible") )
ddlSalesSiteID.visible = -CBool(Application("VendorVisible"))

In this example if Application("VendorVisible") = true then the dropdownlist VendorID should be visible but the dropdownlist SalesSiteID should not.  I want to avoid an if/then statement.
Question by:davidcahan
    LVL 53

    Accepted Solution

    ddlVendorID.visible = not Cbool(Application("VendorVisible") )

    (or c#: ddlVendorID.visible = ! Cbool(Application("VendorVisible") )

    Author Comment


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Training Course: Java/J2EE and SOA

    This course will cover both core and advanced Java concepts like Database connectivity, Threads, Exception Handling, Collections, JSP, Servlets, XMLHandling, and more. You'll also learn various Java frameworks like Hibernate and Spring.

    Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
    I have developed many web applications with asp & and to add and use a dropdownlist was always a very simple task, but with the new, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    how to add IIS SMTP to handle application/Scanner relays into office 365.

    737 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

    22 Experts available now in Live!

    Get 1:1 Help Now