WCF/WF - How to create rows in datagridview dynamically

Asked By Aman on 30-Jun-10 01:51 AM

I am using a datagridview in windows form, now I want to create rows in datagridvew dynamically

It depends on the user input, if he enter 2 then 2 rows will be created if he enter 5, 5 rows will be created


or


is there any way the rows are automatically created when I focus on the last column of the datagridview



Sagar P replied to Aman on 30-Jun-10 02:08 AM

You can use the Rows collection to manually populate a DataGridView control instead of binding it to a data source. The following example shows you how to manually add and insert rows. This example assumes that you have added four DataGridViewTextBoxColumn instances to the control's Columns collection.


this.dataGridView1.Rows.Add("five", "six", "seven", "eight");

this.dataGridView1.Rows.Insert(0, "one", "two", "three", "four");


http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.rows.aspx


http://codingforums.com/showthread.php?t=88760


Anoop S replied to Aman on 30-Jun-10 02:13 AM

refer this for create new row in datagridview

http://forums.silverlight.net/forums/p/183444/416180.aspx