private void txtCust_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { if (e.Button.Index == 0) { //pulsante di ricerca cliente SearchCustomer(); } else if (e.Button.Index == 1) { //pulsante di annullamento cliente txtCust.EditValue = null; } else if (e.Button.Index == 2) { //modifico l'elemento Customer c = controller.CustomCustomer; if (c == null) { return; } else { CustomerForm frm = new CustomerForm(controller.CustomCustomer); try { frm.CheckSecurityForView(); if (frm.ShowDialog() == DialogResult.OK) { txtCust.EditValue = frm.Customer; } } catch (AccessDeniedException) { XtraMessageBox.Show("Impossibile accedere alla funzionalità richiesta. Accesso negato", "Errore", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } else { //new creo uno nuovo CustomerForm frm = new CustomerForm(); if (frm.ShowDialog() == DialogResult.OK) { txtCust.EditValue = frm.Customer; } } }