DataGridViewSelectedCellCollection.CopyTo(DataGridViewCell[], Int32) 方法

定義

將集合的元素複製到指定的 DataGridViewCell 陣列 (從指定的索引開始)。

public:
 void CopyTo(cli::array <System::Windows::Forms::DataGridViewCell ^> ^ array, int index);
public void CopyTo (System.Windows.Forms.DataGridViewCell[] array, int index);
override this.CopyTo : System.Windows.Forms.DataGridViewCell[] * int -> unit
Public Sub CopyTo (array As DataGridViewCell(), index As Integer)

參數

array
DataGridViewCell[]

型別 DataGridViewCell 的一維陣列,其為從集合複製元素的目的端。 陣列必須有以零為起始的索引。

index
Int32

array 中以零起始的索引,即開始複製的位置。

例外狀況

arraynull

index 小於零。

array 是多維的。

-或-

DataGridViewCellCollection 中的項目數大於從 indexarray 結尾之間的可用空間。

DataGridViewCellCollection 無法自動轉換成 array 型別。

適用於

另請參閱