• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 368
  • Last Modified:

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?
0
WDJ98338
Asked:
WDJ98338
1 Solution
 
ClothahumpCommented:
Put code in the click event for the dropdown that enables the save:

Sub DropDown_Click
...
btnSave.Enabled=True
...
End Sub
0
 
VotechCommented:
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.
Graham
0

Featured Post

NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now