DataGridViewCellCollection.Insert(Int32, DataGridViewCell) 方法

定义

将单元格插入集合中的指定索引处。

public:
 virtual void Insert(int index, System::Windows::Forms::DataGridViewCell ^ dataGridViewCell);
public virtual void Insert(int index, System.Windows.Forms.DataGridViewCell dataGridViewCell);
abstract member Insert : int * System.Windows.Forms.DataGridViewCell -> unit
override this.Insert : int * System.Windows.Forms.DataGridViewCell -> unit
Public Overridable Sub Insert (index As Integer, dataGridViewCell As DataGridViewCell)

参数

index
Int32

要放置 dataGridViewCell的从零开始的索引。

dataGridViewCell
DataGridViewCell

DataGridViewCell 插入的。

例外

拥有此权限 DataGridViewCellCollection 的行已属于控件 DataGridView

-或-

dataGridViewCell 已经属于一个 DataGridViewRow

注解

在向控件添加包含行 DataGridView 之前,请使用此方法更改集合。 将行添加到控件后,它包含的单元格数始终与控件中的列数匹配,因此此方法不再有用。

适用于

另请参阅