System.Windows.Forms.DataGridView.CellValueNeeded Event

Occurs when the DataGridView.VirtualMode property of the System.Windows.Forms.DataGridView control is true and the System.Windows.Forms.DataGridView requires a value for a cell in order to format and display the cell.

Syntax

[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)]
public event DataGridViewCellValueEventHandler CellValueNeeded

Remarks

Use this event in virtual mode to populate cells with data from a custom data store without causing rows to become unshared. For more information about row sharing, see Best Practices for Scaling the Windows Forms DataGridView Control. For more information about virtual mode, see Virtual Mode in the Windows Forms DataGridView Control.

To add user-specified values to your custom data store, handle the DataGridView.CellValuePushed event.

For more information about handling events, see Consuming Events.

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0