ListObject::BeforeAddDataBoundRow Event
Occurs just before an attempt to add a new row to a ListObject control that is bound to data.
Assembly: Microsoft.Office.Tools.Excel (in Microsoft.Office.Tools.Excel.dll)
This event is raised only if the ListObject control is bound to data.
This event is raised only when a new row is added through the Microsoft Office Excel user interface. It is not raised when a new row is added programmatically.
Handle this event to perform additional validation, or to cancel addition of a row.
The following code example creates a DataTable and a ListObject, and binds the ListObject to the DataTable. It then creates a BeforeAddDataBoundRow event handler. To test the event, manually add a new row to the ListObject on sheet 1. The event handler removes the row and displays a message.
This version is for a document-level customization.
This version is for an application-level add-in. To use this code example, add the using System.Data; directive if you are using C# or the Imports System.Data statement if you are using Visual Basic.