DataGridViewColumnCollection.Contains Method

Definition

Determines whether the given column is in the collection.

Overloads

Contains(String)

Determines whether the collection contains the column referred to by the given name.

Contains(DataGridViewColumn)

Determines whether the collection contains the given column.

Contains(String)

Source:
DataGridViewColumnCollection.cs
Source:
DataGridViewColumnCollection.cs
Source:
DataGridViewColumnCollection.cs

Determines whether the collection contains the column referred to by the given name.

C#
public virtual bool Contains(string columnName);

Parameters

columnName
String

The name of the column to look for.

Returns

true if the column is contained in the collection; otherwise, false.

Exceptions

columnName is null.

Remarks

The name of a column is indicated by the DataGridViewColumn.Name property.

See also

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9

Contains(DataGridViewColumn)

Source:
DataGridViewColumnCollection.cs
Source:
DataGridViewColumnCollection.cs
Source:
DataGridViewColumnCollection.cs

Determines whether the collection contains the given column.

C#
public virtual bool Contains(System.Windows.Forms.DataGridViewColumn dataGridViewColumn);

Parameters

dataGridViewColumn
DataGridViewColumn

The DataGridViewColumn to look for.

Returns

true if the given column is in the collection; otherwise, false.

See also

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9