Coding drop-down list to enable the Save button

Posted on 2008-11-18
Last Modified: 2013-11-26
I want to code my Drop-down list to enable my save button. By using the properties expression can this be done?
Question by:WDJ98338
    LVL 4

    Expert Comment

    Put code in the click event for the dropdown that enables the save:

    Sub DropDown_Click
    End Sub
    LVL 1

    Accepted Solution

    Create a 'SelectedIndexChanged' event handler for your drop down list, if you do not know how to do that open up your web form or windows form, highlight the drop down list, open up the properties window by pressing F4 if it is not already open, click the "Events" button, then double click the "SelectedIndexChanged" event.

    When in code behind view add:

    If DDL_NAME.SelectedIndexChanged > 0 Then
      BTN_NAME.Enabled = True
    End If

    Replacing DDL_NAME and BTN_NAME with the real control names.  Just remove the If condition if you want the button to be enabled even if the first element is selected in the drop down list.  Usually not as the first element may say '-- Please Select --' or something.

    If this is a Web Form you are doing, you will also need the AutoPostBack property set to "True" on the DropDownList.

    Hope that helps.

    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

    Suggested Solutions

    The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
    Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
    Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
    Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

    746 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

    16 Experts available now in Live!

    Get 1:1 Help Now