DataGridViewCellCollection::Item Property (String^)

 

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

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public:
property DataGridViewCell^ default[
	String^ columnName
] {
	DataGridViewCell^ get(String^ columnName);
	void set(String^ columnName, DataGridViewCell^ value);
}

Parameters

columnName
Type: System::String^

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

Property Value

Type: System.Windows.Forms::DataGridViewCell^

The DataGridViewCell stored in the column with the given name.

Exception Condition
ArgumentException

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

ArgumentNullException

The specified value when setting this property is null.

InvalidOperationException

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.

.NET Framework
Available since 2.0
Return to top
Show: