Click here to Skip to main content
15,905,875 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
how do i create grid view dynamically,?
there are chances that user may add any number of grid views,so on click of button i want to add grid view,
how will i do that.(

thanks in advance
Posted

Have a look at this

click here
 
Share this answer
 
private void button1_Click(object sender, EventArgs e)
      {
          DataGridView grd = new DataGridView();
          Point pt = new Point(0, 0);
          grd.RowCount = 2;
          grd.ColumnCount = 2;
          grd.Location = pt;
          grd.Visible = true;
          this.Controls.Add(grd);
      }


Just set all the DataGridView properties you need. Hope this helps. :)
 
Share this answer
 
Comments
jagadishanil 19-Mar-13 5:12am    
I created gridview dynamically based on condition
how to save data from dynamic created gridview to database
 
Share this answer
 

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