添加行,单击按钮后在datagridview中输入数据 [英] Add rows, enter data in datagridview on button click

查看:60
本文介绍了添加行,单击按钮后在datagridview中输入数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的应用程序中使用了datagridview,并具有一个向datagridview添加新行的按钮,为此,我已在ADD按钮单击事件上将AllowUserToAddRows设置为true.我希望焦点集中在新添加的行上并能够输入一些数据,到目前为止,我的ReadOnly属性设置为false,而editmode的设置位于KeyStroke
任何人都可以帮助我继续前进,而我真的在这里被打动了,无法前进,因为只有在这行得通的情况下才能做进一步的事情

我能够在单击事件上单击按钮添加ADD(AllowUserToAddRows = true)时添加新行,我将列的只读属性设置为false并能够在新添加的行中输入数据.
并能够将焦点设置为新添加的行

dgDtParameters.Rows [dgDtParameters.Rows.Count-1] .Selected = true;

通过添加
删除了datagridiview的重点 ClearSelection()

I am using a datagridview in my apps and having a button to add a new row to datagridview, for that I''ve set AllowUserToAddRows to true on ADD button click event. I want the focus to be on that newly added row and able to enter some data, as of now my ReadOnly property is set to false and that of editmode is on KeyStroke
Can anyone help me to proceed further and I''m really getting struck over here and could not proceed since can do further only if this works

I''m able to add a new row on button click ADD(AllowUserToAddRows = true) on click event, I set the read only property of column to false and was able to enter data in the newly added row.
and able to set the focus to newly added row

dgDtParameters.Rows[dgDtParameters.Rows.Count - 1].Selected = true;

removed the focus of datagridiview by adding
ClearSelection()

推荐答案

是否设置 CurrentCell [^ ]属性帮助?
Does setting the CurrentCell[^] property help?


这篇关于添加行,单击按钮后在datagridview中输入数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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