如何在devexpress gridcontrol中添加新的行行(WinForms C#) [英] How to add new line of row in devexpress gridcontrol?(WinForms C#)

查看:2776
本文介绍了如何在devexpress gridcontrol中添加新的行行(WinForms C#)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在按下按钮时添加一行新的行。在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#)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆