Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

DataGridView.ClearSelection Method (Int32, Int32, Boolean)

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

Cancels the selection of all currently selected cells except the one indicated, optionally ensuring that the indicated cell is selected.

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

protected void ClearSelection (
	int columnIndexException,
	int rowIndexException,
	bool selectExceptionElement
)
protected void ClearSelection (
	int columnIndexException, 
	int rowIndexException, 
	boolean selectExceptionElement
)
protected function ClearSelection (
	columnIndexException : int, 
	rowIndexException : int, 
	selectExceptionElement : boolean
)

Parameters

columnIndexException

The column index to exclude.

rowIndexException

The row index to exclude.

selectExceptionElement

true to select the excluded cell, row, or column; false to retain its original state.

Exception typeCondition

ArgumentOutOfRangeException

columnIndexException is greater than the highest column index.

-or-

columnIndexException is less than -1 when SelectionMode is FullRowSelect; otherwise, columnIndexException is less than 0.

-or-

rowIndexException is greater than the highest row index.

-or-

rowIndexException is less than -1 when SelectionMode is FullColumnSelect; otherwise, rowIndexException is less than 0.

A rowIndexException value of -1 represents a column header, and a columnIndexException value of -1 represents a row header.

This method is useful to clear the current selection without canceling the selection of the cell, row, or column indicated by the exception indexes.

If the SelectionMode property value allows individual cell selection, this method sets the Selected property of each cell to false, excluding the cell in the row and column specified. If the SelectionMode property value allows full row or column selection, this method also sets the Selected property of each row or column to false, excluding the row or column containing the specified cell.

The excluded cell, row, or column may or may not be in the selected state when this method is called. This method selects it if the selectExceptionElement parameter value is true. Depending on the selection mode, the entire row or column may also be selected as a result.

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
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.