DataGridView.GetCellCount Method (DataGridViewElementStates)
Gets the number of cells that satisfy the provided filter.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Return ValueType: System.Int32
The number of cells that match the includeFilter parameter.
The following code example illustrates how to use this method to determine whether there are any cells selected in a DataGridView control. In this example, if any cells are selected, their values are retrieved through the GetClipboardContent method and displayed in a TextBox control.
This code is part of a larger example illustrating the use of the Clipboard features of the DataGridView control. This example is part of a larger example available in How to: Enable Users to Copy Multiple Cells to the Clipboard from the Windows Forms DataGridView Control.
Available since 2.0