DataGridViewColumnCollection.Item[] Property

Definition

Gets or sets a column in the collection.

Overloads

Item[String]

Gets or sets the column of the given name in the collection.

Item[Int32]

Gets or sets the column at the given index in the collection.

Item[String]

Gets or sets the column of the given name in the collection.

public:
 property System::Windows::Forms::DataGridViewColumn ^ default[System::String ^] { System::Windows::Forms::DataGridViewColumn ^ get(System::String ^ columnName); };
public System.Windows.Forms.DataGridViewColumn this[string columnName] { get; }
public System.Windows.Forms.DataGridViewColumn? this[string columnName] { get; }
member this.Item(string) : System.Windows.Forms.DataGridViewColumn
Default Public ReadOnly Property Item(columnName As String) As DataGridViewColumn

Parameters

columnName
String

The name of the column to get or set.

Property Value

The DataGridViewColumn identified by the columnName parameter.

Exceptions

columnName is null.

See also

Applies to

Item[Int32]

Gets or sets the column at the given index in the collection.

public:
 property System::Windows::Forms::DataGridViewColumn ^ default[int] { System::Windows::Forms::DataGridViewColumn ^ get(int index); };
public System.Windows.Forms.DataGridViewColumn this[int index] { get; }
member this.Item(int) : System.Windows.Forms.DataGridViewColumn
Default Public ReadOnly Property Item(index As Integer) As DataGridViewColumn

Parameters

index
Int32

The zero-based index of the column to get or set.

Property Value

The DataGridViewColumn at the given index.

Exceptions

index is less than zero or greater than the number of columns in the collection minus one.

See also

Applies to