56 Microsoft ADO .NET 4 Step by Step 3. Locate the CustomerAccounts_RowChanging event handler, which is called whenever any value in a row changes within the CustomerAccounts table. Add the following code, which checks for valid data involving multiple columns: If (() = True) Then If (CBool(("Active", )) = True) And (IsDBNull(("StartDate", )) = True) Then = "Active accounts must have a valid start date." End If End If 4. Run the program. Use its features to create, edit, and delete data rows. When you attempt to provide invalid data—incorrect data types, violations of business rules, duplicate account names—the program provides the appropriate. | 56 Microsoft 4 Step by Step 3. Locate the CustomerAccounts_RowChanging event handler which is called whenever any value in a row changes within the CustomerAccounts table. Add the following code which checks for valid data involving multiple columns If True Then If CBool Active True And IsDBNull StartDate True Then Active accounts must have a valid start date. End If End If 4. Run the program. Use its features to create edit and delete data rows. When you attempt to provide invalid data incorrect data types violations of business rules duplicate account names the program provides the appropriate error messages. Summary This chapter discussed the DataRow class the final destination of all data in . With one instance created per data record the DataRow class manages each individual columnar field. When used alone its stored values use the generic Object data type but when inserted into a DataTable object s Rows collection all data type limitations and other constraints established for the table s columns act together to verify the row s content. Beyond these column settings you can add event handlers to the DataTable that apply custom business rules to the column and row data providing an additional layer of validation and ultimately integrity for the table s data. Chapter 3 Storing Data in Memory 57 Chapter 3 Quick Reference To Do This Add a row to a DataTable Use the DataTable object s NewRow method to obtain a DataRow instance. Update the Item values in the DataRow as needed. Add the row using the table s method. Delete a row from a DataTable Call the DataRow object s Delete method. Call the DataTable object s AcceptChanges method. Check for data issues in new and modified DataRow objects Create a DataTable. Add DataColumn definitions as needed. Add event handlers for the DataTable object s ColumnChanging RowChanging or other