To create a data event handler, follow these steps:
- Create a new ConReportManager class.
- Open the table design for the table in question; in our case, double-click on the SalesConfirmHeaderTmp.ConReports table extension.
- Expand Events and locate onInserting.
The onInserted event is too late as we want to fill in a field before the record is written; if we subscribed to onInserted, the data will not be saved.
- Right-click on the event and choose Copy event handler method. This will create a code snippet, and place it in the paste buffer.
- Open the ConReportManager class, and paste in the code generated by step 4 into the class body, as shown here:
class ConReportManager { /// <summary> /// /// </summary> /// <param name="sender"></param> ...