且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在devexpress gridcontrol中添加新的行行(WinForms C#)

更新时间:2023-02-20 16:38:43

您不能直接在 GridControl ,因为这只是视图的容器。但是,如果您在 GridControl (或ColumnView的任何其他后代)中使用 GridView ,则可以添加使用 AddNewRow()方法的新行。

You cannot add a new row directly to your GridControl, since this is just a container for the views. However, if you're using a GridView inside your GridControl (or any other descendant of ColumnView), you can add a new row using AddNewRow() method.

(myGridcontrol.MainView as DevExpress.XtraGrid.Views.Grid.GridView).AddNewRow();

链接到文档

编辑:当然可以以不同的方式访问您的视图。

You can access your view in a different way, of course.