DataGridView中的文本框控件 [英] Textbox control in DataGridView
问题描述
我该怎么做?
问题缺乏细节和一般性,但要在 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中的文本框控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!