DataGridViewColumnCollection::GetFirstColumn Method (DataGridViewElementStates, DataGridViewElementStates)
Returns the first column in display order that meets the given inclusion-filter and exclusion-filter requirements.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
public:
DataGridViewColumn^ GetFirstColumn(
DataGridViewElementStates includeFilter,
DataGridViewElementStates excludeFilter
)
Parameters
- includeFilter
-
Type:
System.Windows.Forms::DataGridViewElementStates
A bitwise combination of the DataGridViewElementStates values that represent the filter to apply for inclusion.
- excludeFilter
-
Type:
System.Windows.Forms::DataGridViewElementStates
A bitwise combination of the DataGridViewElementStates values that represent the filter to apply for exclusion.
Return Value
Type: System.Windows.Forms::DataGridViewColumn^The first column in display order that meets the given filter requirements, or null if no column is found.
| Exception | Condition |
|---|---|
| ArgumentException | At least one of the filter values is not a valid bitwise combination of DataGridViewElementStates values. |
The first column in display order is the column with the lowest DisplayIndex value, regardless of whether the column is actually visible on the screen.
This method lets you determine the first column that fits the given criteria without having to compare index values directly.
Available since 2.0