开发者

How can I programmatically replicate the editmode set to EditOnKeystrokeOrF2 behavior of a datagridview?

开发者 https://www.devze.com 2023-04-12 08:10 出处:网络
I use Visual C# with Windows Forms. I need to have a DatagridView Unbounded, with editmode set to EditOnKeystrokeOrF2 and AllowUsersToAddRows to True (defaults) in case the user type something.

I use Visual C# with Windows Forms.

I need to have a DatagridView Unbounded, with editmode set to EditOnKeystrokeOrF2 and AllowUsersToAddRows to True (defaults) in case the user type something.

But also I need to programmatically replicate the same behavior: "Same as when you start to type something a small icon (a pencil) appears at the left side of the row, and a new row is inserted at the end of the dgv."

Thank you开发者_如何转开发 for your help.


Found the solution:

Instead of adding a new row, i just tell the datagrid that the cell is dirty, and voilá: it enters in edit mode, the small pencil appears and a new uncommitted row appears under it ! :)

this.dataGridViewModificadaDetalle.NotifyCurrentCellDirty(true);
0

精彩评论

暂无评论...
验证码 换一张
取 消