Click here to Skip to main content
15,885,365 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
how to add new row at specific position in datagridview c# windows application
Posted
Updated 30-Jun-17 1:27am
v2
Comments
Member 11124794 28-Dec-14 6:42am    
How to create blank row in the middle of gridview vb.net?

gdv.Rows.Insert(3);

here 3 is the position where you want to insert the value.
gdv is the datagridview

Thanks,

Kuthuparakkal
 
Share this answer
 
Hi,
Take the advantage of datatable or your datasouce of datagrid.
Insert the row at any postion and bind your datagrid again.
Try this:
C#
DataRow drow = dtDocTypes.NewRow();
drow[0] = "testName";
drow[1] = "testID";
dtDocTypes.Rows.InsertAt(drow, 10);



--Amit
 
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