Visual Basic: DataGrid Control

OnAddNew Event

See Also   Example   Applies To

Occurs when a user action invokes an AddNew operation.

Syntax

Private Sub object_OnAddNew([ index As Integer])

The OnAddNew event syntax has these parts:

Part Description
object An object expression that evaluates to an object in the Applies To list.
index An integer that identifies a control if it is in a control array.

Remarks

The OnAddNew event occurs when an AddNew operation has been initiated by either of the following:

  • The user modifies a cell within the AddNew row. Typically, this occurs as soon as the user types a character, but may also occur as a result of a built-in radio button or combo box selection.

  • The Value or Text property of a column is set in code when the current cell is within the AddNew row.

This event occurs only if the grid's AllowAddNew property is True.

When the OnAddNew event is fired, the value of the AddNewMode property is 2 - AddNew Pending.