DataGridViewCellCollection.Add(DataGridViewCell) メソッド

定義

コレクションにセルを追加します。

public:
 virtual int Add(System::Windows::Forms::DataGridViewCell ^ dataGridViewCell);
public virtual int Add(System.Windows.Forms.DataGridViewCell dataGridViewCell);
abstract member Add : System.Windows.Forms.DataGridViewCell -> int
override this.Add : System.Windows.Forms.DataGridViewCell -> int
Public Overridable Function Add (dataGridViewCell As DataGridViewCell) As Integer

パラメーター

dataGridViewCell
DataGridViewCell

コレクションに追加する DataGridViewCell

返品

新しい要素を挿入する位置。

例外

この DataGridViewCellCollection を所有する行は、既に DataGridView コントロールに属しています。

-又は-

dataGridViewCell は既に DataGridViewRowに属しています。

注釈

DataGridViewRow コントロールに行を追加する前に、DataGridViewにセルを設定するには、このメソッドを使用します。 コントロールに行を追加すると、その行に含まれるセルの数は常にコントロール内の列数と一致するため、このメソッドは役に立たなくなります。

適用対象

こちらもご覧ください