问题描述
我想在按下按钮时添加一行新的行。在datagridview中,它将是:
datagridview1.Rows.Add()
I want to add a new line of row when pressing a button. In datagridview it would be:datagridview1.Rows.Add()
gridcontrol中的等效代码是什么?请帮助我。
What is the equivalent code for that in gridcontrol? Please help me.
推荐答案
您不能直接在 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.
这篇关于如何在devexpress gridcontrol中添加新的行行(WinForms C#)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!