我该怎么做?
解决方案问题缺乏细节和一般性,但要在 DataGridView 中获取文本框,您将要添加一些 DataGridViewTextBoxColumn 到 DataGridView 的列集合。这将导致它们在每行中都填充有文本框。
要检测用户在第3列上按下标签的时间,您可以添加1-2像素宽的第四列列,并使用 OnCellEnter 事件收到焦点(几乎绝对来自标签按键)。
好运气!
I am working on a datagridview in C# in windows application. I want to add textbox controls in DataGridView. So, when we run it then textbox should be shown in gridview and we can put value in it and My grid has 3 columns and I want to add new row in grid when I press tab on 3rd column of gridview.
How do I do this?
解决方案It's hard to provide a precise answer since your question is lacking in detail and pretty general, but to get textboxes in your DataGridView, you're going to want to add some instances of DataGridViewTextBoxColumn to the DataGridView's Columns collection. This will cause them to be populated with textboxes in each row.
To detect when the user presses tab on the 3rd column, you can add a 1-2 pixel wide fourth column and detect that it has recieved focus (almost definitely from a tab keystroke) using the OnCellEnter event.
Good luck!
更多推荐
DataGridView中的文本框控件
发布评论