1

我知道我可以通过以下方式分配gridview:

public static DataGridView grid = new DataGridView();

但我想要一个数组

4

3 回答 3

1

像这样的东西

List<DataGridView> Grids = new List<DataGridView>();
// Assigning new DataGridViews
for (int i = 0; i < 5; i++)
  Grids.Add(new DataGridView());
// Fetching one
DataGridView fetched = Grids[2];
于 2012-09-12T13:31:25.787 回答
0

你试过了吗:

DataGridView [] myArray = new DataGridView [5];
myArray[0] = new DataGridView();
// ...
于 2012-09-12T13:28:50.033 回答
0

尝试

public static List < DataGridView >  grids = new List < DataGridView > (); 
于 2012-09-12T13:29:13.310 回答