Coding drop-down list to enable the Save button

I want to code my Drop-down list to enable my save button. By using the properties expression can this be done?
Who is Participating?
VotechConnect With a Mentor Commented:
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.
Put code in the click event for the dropdown that enables the save:

Sub DropDown_Click
End Sub
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.