Editare

Partajați prin


DataGridViewCellCollection.Item[] Property

Definition

Gets or sets the item at the provided location. In C#, this property is the indexer for the DataGridViewCellCollection class.

Overloads

Item[Int32]

Gets or sets the cell at the provided index location. In C#, this property is the indexer for the DataGridViewCellCollection class.

Item[String]

Gets or sets the cell in the column with the provided name. In C#, this property is the indexer for the DataGridViewCellCollection class.

Item[Int32]

Gets or sets the cell at the provided index location. In C#, this property is the indexer for the DataGridViewCellCollection class.

public:
 property System::Windows::Forms::DataGridViewCell ^ default[int] { System::Windows::Forms::DataGridViewCell ^ get(int index); void set(int index, System::Windows::Forms::DataGridViewCell ^ value); };
public System.Windows.Forms.DataGridViewCell this[int index] { get; set; }
member this.Item(int) : System.Windows.Forms.DataGridViewCell with get, set
Default Public Property Item(index As Integer) As DataGridViewCell

Parameters

index
Int32

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

Property Value

The DataGridViewCell stored at the given index.

Exceptions

The specified value when setting this property is null.

The specified cell when setting this property already belongs to a DataGridView control.

-or-

The specified cell when setting this property already belongs to a DataGridViewRow.

index is less than 0.

-or-

index is equal to or greater than the number of cells in the collection.

See also

Applies to

Item[String]

Gets or sets the cell in the column with the provided name. In C#, this property is the indexer for the DataGridViewCellCollection class.

public:
 property System::Windows::Forms::DataGridViewCell ^ default[System::String ^] { System::Windows::Forms::DataGridViewCell ^ get(System::String ^ columnName); void set(System::String ^ columnName, System::Windows::Forms::DataGridViewCell ^ value); };
public System.Windows.Forms.DataGridViewCell this[string columnName] { get; set; }
member this.Item(string) : System.Windows.Forms.DataGridViewCell with get, set
Default Public Property Item(columnName As String) As DataGridViewCell

Parameters

columnName
String

The name of the column in which to get or set the cell.

Property Value

The DataGridViewCell stored in the column with the given name.

Exceptions

columnName does not match the name of any columns in the control.

The specified value when setting this property is null.

The specified cell when setting this property already belongs to a DataGridView control.

-or-

The specified cell when setting this property already belongs to a DataGridViewRow.

See also

Applies to