I'm trying to do some validation of the vendor's address before it is saved from the Vendor Maintenance form.
I have an event handler:
void SaveVendorRecord_ValidateBeforeOriginal ( object sender, System.ComponentModel.CancelEventArgs e )
{
string normalphonenumber = string.Empty;
try
{
normalphonenumber = NormalizePhoneNumber ( vendorwindow.PhoneNumber1.Value );
vendorwindow.PhoneNumber1.Value = normalphonenumber;
normalphonenumber = NormalizePhoneNumber ( vendorwindow.PhoneNumber2.Value );
vendorwindow.PhoneNumber2.Value = normalphonenumber;
}
catch ( Exception ex )
{
MessageBox.Show ( ex.Message );
e.Cancel = true;
}
}
attached to the window's SaveRecord field:
vendorwindow.SaveRecord.ValidateBeforeOriginal += SaveVendorRecord_ValidateBeforeOriginal;
Unfortunately the event handler is never called.
Does anyone have an idea as to why? I'm using the same code for the RmCustomerMaintenance, RmCustomerAddress, and PmVendorAddress windows where it works fine, only the PmVendorMaintenance gives me problems.
Peter
DGP 2015R2 VST C#
*This post is locked for comments