DataGridViewCellCollection.Item[] 属性

定义

获取或设置位于提供位置的项。 在 C# 中,此属性是类的 DataGridViewCellCollection 索引器。

重载

名称 说明
Item[Int32]

获取或设置位于提供的索引位置的单元格。 在 C# 中,此属性是类的 DataGridViewCellCollection 索引器。

Item[String]

获取或设置列中具有提供的名称的单元格。 在 C# 中,此属性是类的 DataGridViewCellCollection 索引器。

Item[Int32]

Source:
DataGridViewCellCollection.cs
Source:
DataGridViewCellCollection.cs
Source:
DataGridViewCellCollection.cs
Source:
DataGridViewCellCollection.cs
Source:
DataGridViewCellCollection.cs

获取或设置位于提供的索引位置的单元格。 在 C# 中,此属性是类的 DataGridViewCellCollection 索引器。

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

参数

index
Int32

要获取或设置的单元格的从零开始的索引。

属性值

DataGridViewCell存储在给定索引处。

例外

设置此属性时指定的值为 null.

设置此属性时指定的单元格已属于控件 DataGridView

-或-

设置此属性时指定的单元格已属于一个 DataGridViewRow

index 小于 0。

-或-

index 等于或大于集合中的单元格数。

另请参阅

适用于

Item[String]

Source:
DataGridViewCellCollection.cs
Source:
DataGridViewCellCollection.cs
Source:
DataGridViewCellCollection.cs
Source:
DataGridViewCellCollection.cs
Source:
DataGridViewCellCollection.cs

获取或设置列中具有提供的名称的单元格。 在 C# 中,此属性是类的 DataGridViewCellCollection 索引器。

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

参数

columnName
String

要在其中获取或设置单元格的列的名称。

属性值

DataGridViewCell存储在具有给定名称的列中。

例外

columnName 与控件中的任何列的名称不匹配。

设置此属性时指定的值为 null.

设置此属性时指定的单元格已属于控件 DataGridView

-或-

设置此属性时指定的单元格已属于一个 DataGridViewRow

另请参阅

适用于