Export (0) Print
Expand All
Expand Minimize

DataGridView.CellMouseClick Event

Note: This event is new in the .NET Framework version 2.0.

Occurs whenever the user clicks anywhere on a cell with the mouse.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

public event DataGridViewCellMouseEventHandler CellMouseClick
/** @event */
public void add_CellMouseClick (DataGridViewCellMouseEventHandler value)

/** @event */
public void remove_CellMouseClick (DataGridViewCellMouseEventHandler value)

JScript supports the use of events, but not the declaration of new ones.

This event occurs when the user clicks using any of the mouse buttons. Use the MouseEventArgs.Button property to determine which button was clicked.

To detect clicks on the contents of a cell, such as a button or link within a cell, use the CellContentClick event.

The handler for this event receives the column index and row index of the mouse pointer position.

For clicks in a DataGridViewCheckBoxCell, this event occurs before the check box changes value, so if you do not want to calculate the expected value based on the current value, you will typically handle the CellValueChanged event instead. Because that event occurs only when the user-specified value is committed, which typically occurs when focus leaves the cell, you must also handle the CurrentCellDirtyStateChanged event. In that handler, if the current cell is a check box cell, call the CommitEdit method and pass in the Commit value.

For more information about handling events, see Consuming Events.

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0

Community Additions

ADD
Show:
© 2014 Microsoft