Combo Box Event Firing at Load

Posted on 2006-06-08
Last Modified: 2010-04-23
I have an application such that it has a combo box and when the form is up and loaded; I'd like to call another form when they select an item in the combo box.

I've tried putting the following code in various events (its currently in selectedvaluechange) but no matter where I put it; opens the form when it first loads without anyone even having an opportunity to see the combo box on the screen much less click on it.

Should I be using a diff event or different code.

Under selectedvaluechange I have

  If cboDiscounts.Text Like "**" Or System.Convert.IsDBNull(cboDiscounts.Text) = True Then


        End If

Basically; by using if which I'm not even sure you can use in an expression or isdbnull; I'm trying to tell it that while the form is still loading and the text in the comboxbox is blank; do nothing. Wait for the combo to load and let the user click something then open the form.

No success. yet.
Thanks for anyones help with this !
Question by:sny23vpb
    LVL 34

    Accepted Solution

    Best bet is to declare a form level boolean variable

       Private Loading As Boolean = True


       If Loading Then Exit Sub

    in your combobox' event procedure/s

    and not set

       Loading = False

    until the end of your form_load sub


    Author Comment

    what event would you put the loading=false in ?  I tried at the end of initializecomponent I tried at the end of finalize ; but no luck.

    Thanks again.
    LVL 34

    Expert Comment

    Form_Load or Form_Activated, assuming that your combobox is fully loaded with values, or bound to a datasource that is fully loaded with values, at that point.

    LVL 5

    Expert Comment

    are using windows application or web application??

    Author Comment

    windows application in visual studio 2003.  Perhaps I'm not looking in the right place. I only see the events for   new, finalize, and initialize component.  I don't see a form load event. Thanks for your help.
    LVL 5

    Assisted Solution

    well you can double click your fomr designer and then the from load event will appear..


    Author Comment

    Thank you

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
    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 …
    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…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    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