Skip to main content
A newer version of this page is available. .

How to: Respond to Editor's Value Modification

  • 2 minutes to read

The following sample code handles the RepositoryItem.Modified event of a MemoEdit control to make the toolBarSaveButton of the toolBar1 control enabled each time the end-user starts to change memo edit contents. The ButtonClick event is handled in order to validate the memo editor using the BaseEdit.DoValidate method and to perform specific actions in response to button click events (for example, you can save memo edit contents to a file). Once all necessary operations are performed, toolBarSaveButton is disabled.

using System.Windows.Forms;
using DevExpress.XtraEditors;
// ...
private void memoEdit1_Modified(object sender, System.EventArgs e) {
   toolBarSaveButton.Enabled = true;
}

private void toolBar1_ButtonClick(object sender, ToolBarButtonClickEventArgs e) {
   // Checking whether the toolBarSaveButton has been clicked
   if (e.Button == toolBarSaveButton){
      // Validating the memoEdit1
      memoEdit1.DoValidate();
      /*
         * 
         * Here you can save the memoEdit1 contents or 
         * perform some other specific actions in response to button click
         */
      // Making the button disabled
      e.Button.Enabled = false;
   }
}