DataGridView Events
.NET Framework 2.0
| Name | Description | |
|---|---|---|
| AllowUserToAddRowsChanged | Occurs when the value of the AllowUserToAddRows property changes. |
| AllowUserToDeleteRowsChanged | Occurs when the value of the AllowUserToDeleteRowsChanged property changes. |
| AllowUserToOrderColumnsChanged | Occurs when the value of the AllowUserToOrderColumns property changes. |
| AllowUserToResizeColumnsChanged | Occurs when the value of the AllowUserToResizeColumns property changes. |
| AllowUserToResizeRowsChanged | Occurs when the value of the AllowUserToResizeRows property changes. |
| AlternatingRowsDefaultCellStyleChanged | Occurs when the value of the AlternatingRowsDefaultCellStyle property changes. |
| AutoGenerateColumnsChanged | Occurs when the value of the AutoGenerateColumnsChanged property changes. |
| AutoSizeChanged | This event is not relevant for this class. (Inherited from Control.) |
| AutoSizeColumnModeChanged | Occurs when the value of the AutoSizeMode property of a column changes. |
| AutoSizeColumnsModeChanged | Occurs when the value of the AutoSizeColumnsMode property changes. |
| AutoSizeRowsModeChanged | Occurs when the value of the DataGridViewAutoSizeRowsMode property changes. |
| BackColorChanged | Occurs when the value of the BackColor property changes. |
| BackgroundColorChanged | Occurs when the value of the BackgroundColor property changes. |
| BackgroundImageChanged | Occurs when the value of the BackgroundImage property changes. |
| BackgroundImageLayoutChanged | Occurs when the BackgroundImageLayout property changes. |
| BindingContextChanged | Occurs when the value of the BindingContext property changes. (Inherited from Control.) |
| BorderStyleChanged | Occurs when the value of the BorderStyle property changes. |
| CancelRowEdit | Occurs when the VirtualMode property of a DataGridView control is true and the cancels edits in a row. |
| CausesValidationChanged | Occurs when the value of the CausesValidation property changes. (Inherited from Control.) |
| CellBeginEdit | Occurs when edit mode starts for the selected cell. |
| CellBorderStyleChanged | Occurs when the border style of a cell changes. |
| CellClick | Occurs when any part of a cell is clicked. |
| CellContentClick | Occurs when the content within a cell is clicked. |
| CellContentDoubleClick | Occurs when the user double-clicks a cell's contents. |
| CellContextMenuStripChanged | Occurs when the ContextMenuStrip property changes. |
| CellContextMenuStripNeeded | Occurs when a cell's shortcut menu is needed. |
| CellDoubleClick | Occurs when the user double-clicks anywhere in a cell. |
| CellEndEdit | Occurs when edit mode stops for the currently selected cell. |
| CellEnter | Occurs when the current cell changes in the DataGridView control or when the control receives input focus. |
| CellErrorTextChanged | Occurs when the value of the ErrorText property of a cell changes. |
| CellErrorTextNeeded | Occurs when a cell's error text is needed. |
| CellFormatting | Occurs when the contents of a cell need to be formatted for display. |
| CellLeave | Occurs when a cell loses input focus and is no longer the current cell. |
| CellMouseClick | Occurs whenever the user clicks anywhere on a cell with the mouse. |
| CellMouseDoubleClick | Occurs when a cell within the DataGridView is double-clicked. |
| CellMouseDown | Occurs when the user presses a mouse button while the mouse pointer is within the boundaries of a cell. |
| CellMouseEnter | Occurs when the mouse pointer enters a cell. |
| CellMouseLeave | Occurs when the mouse pointer leaves a cell. |
| CellMouseMove | Occurs when the mouse pointer moves over the DataGridView control. |
| CellMouseUp | Occurs when the user releases a mouse button while over a cell. |
| CellPainting | Occurs when a cell needs to be drawn. |
| CellParsing | Occurs when a cell leaves edit mode if the cell value has been modified. |
| CellStateChanged | Occurs when a cell state changes, such as when the cell loses or gains focus. |
| CellStyleChanged | Occurs when the Style property of a DataGridViewCell changes. |
| CellStyleContentChanged | Occurs when one of the values of a cell style changes. |
| CellToolTipTextChanged | Occurs when the ToolTipText property value changes for a cell in the DataGridView. |
| CellToolTipTextNeeded | Occurs when a cell's ToolTip text is needed. |
| CellValidated | Occurs after the cell has finished validating. |
| CellValidating | Occurs when a cell loses input focus, enabling content validation. |
| CellValueChanged | Occurs when the value of a cell changes. |
| CellValueNeeded | Occurs when the VirtualMode property of the DataGridView control is true and the DataGridView requires a value for a cell in order to format and display the cell. |
| CellValuePushed | Occurs when the VirtualMode property of the DataGridView control is true and a cell value has changed and requires storage in the underlying data source. |
| ChangeUICues | Occurs when the focus or keyboard user interface (UI) cues change. (Inherited from Control.) |
| Click | Occurs when the control is clicked. (Inherited from Control.) |
| ClientSizeChanged | Occurs when the value of the ClientSize property changes. (Inherited from Control.) |
| ColumnAdded | Occurs when a column is added to the control. |
| ColumnContextMenuStripChanged | Occurs when the ContextMenuStrip property of a column changes. |
| ColumnDataPropertyNameChanged | Occurs when the value of the DataPropertyName property for a column changes. |
| ColumnDefaultCellStyleChanged | Occurs when the value of the DefaultCellStyle property for a column changes. |
| ColumnDisplayIndexChanged | Occurs when the value the DisplayIndex property for a column changes. |
| ColumnDividerDoubleClick | Occurs when the user double-clicks a divider between two columns. |
| ColumnDividerWidthChanged | Occurs when the DividerWidth property changes. |
| ColumnHeaderCellChanged | Occurs when the contents of a column header cell change. |
| ColumnHeaderMouseClick | Occurs when the user clicks a column header. |
| ColumnHeaderMouseDoubleClick | Occurs when a column header is double-clicked. |
| ColumnHeadersBorderStyleChanged | Occurs when the ColumnHeadersBorderStyle property changes. |
| ColumnHeadersDefaultCellStyleChanged | Occurs when the value of the ColumnHeadersDefaultCellStyle property changes. |
| ColumnHeadersHeightChanged | Occurs when the value of the ColumnHeadersHeight property changes. |
| ColumnHeadersHeightSizeModeChanged | Occurs when the value of the ColumnHeadersHeightSizeMode property changes. |
| ColumnMinimumWidthChanged | Occurs when the value of the MinimumWidth property for a column changes. |
| ColumnNameChanged | Occurs when the value of the Name property for a column changes. |
| ColumnRemoved | Occurs when a column is removed from the control. |
| ColumnSortModeChanged | Occurs when the value of the SortMode property for a column changes. |
| ColumnStateChanged | Occurs when a column changes state, such as gaining or losing focus. |
| ColumnToolTipTextChanged | Occurs when the ToolTipText property value changes for a column in the DataGridView. |
| ColumnWidthChanged | Occurs when the value of the Width property for a column changes. |
| ContextMenuChanged | Occurs when the value of the ContextMenu property changes. (Inherited from Control.) |
| ContextMenuStripChanged | Occurs when the value of the ContextMenuStrip property changes. (Inherited from Control.) |
| ControlAdded | Occurs when a new control is added to the Control.ControlCollection. (Inherited from Control.) |
| ControlRemoved | Occurs when a control is removed from the Control.ControlCollection. (Inherited from Control.) |
| CurrentCellChanged | Occurs when the CurrentCell property changes. |
| CurrentCellDirtyStateChanged | Occurs when the state of a cell changes in relation to a change in its contents. |
| CursorChanged | Occurs when the value of the Cursor property changes. (Inherited from Control.) |
| DataBindingComplete | Occurs after a data-binding operation has finished. |
| DataError | Occurs when an external data-parsing or validation operation throws an exception, or when an attempt to commit data to a data source fails. |
| DataMemberChanged | Occurs when value of the DataMember property changes. |
| DataSourceChanged | Occurs when the value of the DataSource property changes. |
| DefaultCellStyleChanged | Occurs when the value of the DefaultCellStyle property changes. |
| DefaultValuesNeeded | Occurs when the user enters the row for new records so that it can be populated with default values. |
| Disposed | Adds an event handler to listen to the Disposed event on the component. (Inherited from Component.) |
| DockChanged | Occurs when the value of the Dock property changes. (Inherited from Control.) |
| DoubleClick | Occurs when the control is double-clicked. (Inherited from Control.) |
| DragDrop | Occurs when a drag-and-drop operation is completed. (Inherited from Control.) |
| DragEnter | Occurs when an object is dragged into the control's bounds. (Inherited from Control.) |
| DragLeave | Occurs when an object is dragged out of the control's bounds. (Inherited from Control.) |
| DragOver | Occurs when an object is dragged over the control's bounds. (Inherited from Control.) |
| EditingControlShowing | Occurs when a control for editing a cell is showing. |
| EditModeChanged | Occurs when the value of the EditMode property changes. |
| EnabledChanged | Occurs when the Enabled property value has changed. (Inherited from Control.) |
| Enter | Occurs when the control is entered. (Inherited from Control.) |
| FontChanged | Occurs when the Font property value changes. |
| ForeColorChanged | Occurs when the ForeColor property value changes. |
| GiveFeedback | Occurs during a drag operation. (Inherited from Control.) |
| GotFocus | Occurs when the control receives focus. (Inherited from Control.) |
| GridColorChanged | Occurs when the value of the GridColor property changes. |
| HandleCreated | Occurs when a handle is created for the control. (Inherited from Control.) |
| HandleDestroyed | Occurs when the control's handle is in the process of being destroyed. (Inherited from Control.) |
| HelpRequested | Occurs when the user requests help for a control. (Inherited from Control.) |
| ImeModeChanged | Occurs when the ImeMode property has changed. (Inherited from Control.) |
| Invalidated | Occurs when a control's display requires redrawing. (Inherited from Control.) |
| KeyDown | Occurs when a key is pressed while the control has focus. (Inherited from Control.) |
| KeyPress | Occurs when a key is pressed while the control has focus. (Inherited from Control.) |
| KeyUp | Occurs when a key is released while the control has focus. (Inherited from Control.) |
| Layout | Occurs when a control should reposition its child controls. (Inherited from Control.) |
| Leave | Occurs when the input focus leaves the control. (Inherited from Control.) |
| LocationChanged | Occurs when the Location property value has changed. (Inherited from Control.) |
| LostFocus | Occurs when the control loses focus. (Inherited from Control.) |
| MarginChanged | Occurs when the control's margin changes. (Inherited from Control.) |
| MouseCaptureChanged | Occurs when the control loses mouse capture. (Inherited from Control.) |
| MouseClick | Occurs when the control is clicked by the mouse. (Inherited from Control.) |
| MouseDoubleClick | Occurs when the control is double clicked by the mouse. (Inherited from Control.) |
| MouseDown | Occurs when the mouse pointer is over the control and a mouse button is pressed. (Inherited from Control.) |
| MouseEnter | Occurs when the mouse pointer enters the control. (Inherited from Control.) |
| MouseHover | Occurs when the mouse pointer rests on the control. (Inherited from Control.) |
| MouseLeave | Occurs when the mouse pointer leaves the control. (Inherited from Control.) |
| MouseMove | Occurs when the mouse pointer is moved over the control. (Inherited from Control.) |
| MouseUp | Occurs when the mouse pointer is over the control and a mouse button is released. (Inherited from Control.) |
| MouseWheel | Occurs when the mouse wheel moves while the control has focus. (Inherited from Control.) |
| Move | Occurs when the control is moved. (Inherited from Control.) |
| MultiSelectChanged | Occurs when the value of the MultiSelect property changes. |
| NewRowNeeded | Occurs when the VirtualMode property of the DataGridView is true and the user navigates to the new row at the bottom of the DataGridView. |
| PaddingChanged | Occurs when the value of the Padding property changes. |
| Paint | Occurs when the control is redrawn. (Inherited from Control.) |
| ParentChanged | Occurs when the Parent property value changes. (Inherited from Control.) |
| PreviewKeyDown | Occurs before the KeyDown event when a key is pressed while focus is on this control. (Inherited from Control.) |
| QueryAccessibilityHelp | Occurs when AccessibleObject is providing help to accessibility applications. (Inherited from Control.) |
| QueryContinueDrag | Occurs during a drag-and-drop operation and enables the drag source to determine whether the drag-and-drop operation should be canceled. (Inherited from Control.) |
| ReadOnlyChanged | Occurs when the ReadOnly property changes. |
| RegionChanged | Occurs when the value of the Region property changes. (Inherited from Control.) |
| Resize | Occurs when the control is resized. (Inherited from Control.) |
| RightToLeftChanged | Occurs when the RightToLeft property value changes. (Inherited from Control.) |
| RowContextMenuStripChanged | Occurs when the ContextMenuStrip property changes. |
| RowContextMenuStripNeeded | Occurs when a row's shortcut menu is needed. |
| RowDefaultCellStyleChanged | Occurs when the value of the DefaultCellStyle property for a row changes. |
| RowDirtyStateNeeded | Occurs when the VirtualMode property of the DataGridView control is true and the DataGridView needs to determine whether the current row has uncommitted changes. |
| RowDividerDoubleClick | Occurs when the user double-clicks the divider between two rows. |
| RowDividerHeightChanged | Occurs when the DividerHeight property changes. |
| RowEnter | Occurs when a row receives input focus and becomes the current row. |
| RowErrorTextChanged | Occurs when the ErrorText property of a row changes. |
| RowErrorTextNeeded | Occurs when a row's error text is needed. |
| RowHeaderCellChanged | Occurs when the user changes the contents of a row header cell. |
| RowHeaderMouseClick | Occurs when the user clicks within the boundaries of a row header. |
| RowHeaderMouseDoubleClick | Occurs when a row header is double-clicked. |
| RowHeadersBorderStyleChanged | Occurs when the RowHeadersBorderStyle property changes. |
| RowHeadersDefaultCellStyleChanged | Occurs when the value of the RowHeadersDefaultCellStyle property changes. |
| RowHeadersWidthChanged | Occurs when value of the RowHeadersWidth property changes. |
| RowHeadersWidthSizeModeChanged | Occurs when the value of the RowHeadersWidthSizeMode property changes. |
| RowHeightChanged | Occurs when the value of the Height property for a row changes. |
| RowHeightInfoNeeded | Occurs when information about row height is requested. |
| RowHeightInfoPushed | Occurs when the user changes the height of a row. |
| RowLeave | Occurs when a row loses input focus and is no longer the current row. |
| RowMinimumHeightChanged | Occurs when the value of the MinimumHeight property for a row changes. |
| RowPostPaint | Occurs after a DataGridViewRow is painted. |
| RowPrePaint | Occurs before a DataGridViewRow is painted |
| RowsAdded | Occurs after a new row is added to the DataGridView. |
| RowsDefaultCellStyleChanged | Occurs when the value of the RowsDefaultCellStyle property changes. |
| RowsRemoved | Occurs when a row or rows are deleted from the DataGridView. |
| RowStateChanged | Occurs when a row changes state, such as losing or gaining input focus. |
| RowUnshared | Occurs when a row's state changes from shared to unshared. |
| RowValidated | Occurs after a row has finished validating. |
| RowValidating | Occurs when a row is validating. |
| Scroll | Occurs when the user scrolls through the control contents. |
| SelectionChanged | Occurs when the current selection changes. |
| SizeChanged | Occurs when the Size property value changes. (Inherited from Control.) |
| SortCompare | Occurs when the DataGridView compares two cell values to perform a sort operation. |
| Sorted | Occurs when the DataGridView control completes a sorting operation. |
| StyleChanged | Occurs when the control style changes. |
| SystemColorsChanged | Occurs when the system colors change. (Inherited from Control.) |
| TabIndexChanged | Occurs when the TabIndex property value changes. (Inherited from Control.) |
| TabStopChanged | Occurs when the TabStop property value changes. (Inherited from Control.) |
| TextChanged | Occurs when the value of the Text property changes. |
| UserAddedRow | Occurs when the user has finished adding a row to the DataGridView control. |
| UserDeletedRow | Occurs when the user has finished deleting a row from the DataGridView control. |
| UserDeletingRow | Occurs when the user deletes a row from the DataGridView control. |
| Validated | Occurs when the control is finished validating. (Inherited from Control.) |
| Validating | Occurs when the control is validating. (Inherited from Control.) |
| VisibleChanged | Occurs when the Visible property value changes. (Inherited from Control.) |
Reference
DataGridView ClassSystem.Windows.Forms Namespace
Other Resources
DataGridView Control (Windows Forms)DataGridView Control Overview (Windows Forms)
Basic Formatting and Styling in the Windows Forms DataGridView Control
Displaying Data in the Windows Forms DataGridView Control
Data Display Modes in the Windows Forms DataGridView Control
Differences Between the Windows Forms DataGridView and DataGrid Controls