如何在datagridview中的特定位置添加新行 [英] How to add new row at particular position in datagridview
本文介绍了如何在datagridview中的特定位置添加新行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在datagridview中的特定位置添加新行c#windows application
how to add new row at specific position in datagridview c# windows application
推荐答案
gdv.Rows.Insert(3);
这里3是你要插入值的位置。
gdv是datagridview
谢谢,
Kuthuparakkal
gdv.Rows.Insert(3);
here 3 is the position where you want to insert the value.
gdv is the datagridview
Thanks,
Kuthuparakkal
您可以使用 dataGridView1.Rows.Insert()方法。请在下面找到示例。
http://social.msdn.microsoft.com/Forums/en/winformsdatacontrols/thread/11fd0594-48ee-4f7f-b895-192a9d3a9f1e [ ^ ]
http:// stackoverflow .com / questions / 10063770 / c-sharp-how-to-new-row-to-datagridview-programmingmatically [ ^ ]
http://www.dreamincode达网络/论坛/主题/ 39260-加入-行到一个数据-grid-view / [ ^ ]
问候
Sebastian
You can use dataGridView1.Rows.Insert() method. Please find examples below.
http://social.msdn.microsoft.com/Forums/en/winformsdatacontrols/thread/11fd0594-48ee-4f7f-b895-192a9d3a9f1e[^]
http://stackoverflow.com/questions/10063770/c-sharp-how-to-add-a-new-row-to-datagridview-programmatically[^]
http://www.dreamincode.net/forums/topic/39260-adding-rows-to-a-data-grid-view/[^]
Regards
Sebastian
利用数据表或数据网格的数据。
在任意位置插入行并再次绑定数据网格。
试试这个:
Hi,
Take the advantage of datatable or your datasouce of datagrid.
Insert the row at any postion and bind your datagrid again.
Try this:
DataRow drow = dtDocTypes.NewRow();
drow[0] = "testName";
drow[1] = "testID";
dtDocTypes.Rows.InsertAt(drow, 10);
--Amit
--Amit
这篇关于如何在datagridview中的特定位置添加新行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文