开发者

WinForms DatagridView allows deletion via Shift + Del keys even though AllowUserToDeleteRows property is set to false

I'm using the stand开发者_JS百科ard .Net Winforms datagridview control to display & manipulate data, however I have (or thought so) suppressed user deletion via:

this.dataGridViewTestSteps.AllowUserToDeleteRows = false;

Now pressing 'Del' does in fact not delete rows, but surprisingly Pressing [Shift] and [Del] at the same time does. What's up with Shift-key overriding the property set above? Is there anything I can do to fully disallow deletion?


Oh my - the solution is apparently rather simple, but somewhat unexpected: Shift + Del seems to be a system wide alternative to Ctrl + X. E.g. when editing a text in notepad.exe, selecting some characters and pressing Shift + Del it seems to have the same effect & functionality as a standard Cut / Ctrl + X would do.

Since I do handle Ctrl + x in my application, it does proceed and 'delete' these rows, even though they are actually placed on the clipboard.

So this has nothing to do in particular with the datagridview, usercode for ctrl + x is simply also called when shift + del is pressed.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜