Click here to Skip to main content
15,905,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Friends,

I am in following case:

I want to add 'n' Datagridviews in my form, where n>0 maybe n=1,2,...etc.

How I can do that programatically, maybe inside in a For cicle

I have various types of data in my db and I want to put them in
differents Datagridviews, that is the reason that i need your help.

Thanks in advance,

Leonardo Ayala R.
Posted
Updated 5-Jan-11 10:18am
v2

1 solution

Not that difficult

foreach(int x = 0; x < n; x++)
{
   DataGridView dv = new DataGridView();
   dv.DataSource = ...
   Controls.Add(dv);
}
 
Share this answer
 
Comments
fjdiewornncalwe 5-Jan-11 17:39pm    
Nice and clear.
Dalek Dave 5-Jan-11 20:39pm    
Good Answer.
leocode7 14-Jan-11 17:07pm    
thanks!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900