1

I know i can assign gridview by:

public static DataGridView grid = new DataGridView();

but i want an array

1
  • 1
    Have you tried List<GridView> ? Commented Sep 12, 2012 at 13:25

3 Answers 3

1

Something like this

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];
Sign up to request clarification or add additional context in comments.

Comments

0

did you try:

DataGridView [] myArray = new DataGridView [5];
myArray[0] = new DataGridView();
// ...

1 Comment

i was needed a 2d array so i did this public static DataGridView[,] grid = new DataGridView[3,7]; thanks
0

try

public static List < DataGridView >  grids = new List < DataGridView > (); 

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.