Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
WinForms DataGrid delete
Message
From
07/10/2004 20:24:53
 
 
To
All
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Title:
WinForms DataGrid delete
Miscellaneous
Thread ID:
00949754
Message ID:
00949754
Views:
84
This may be a .NET question more than a MM.NET question, but thought I'd check...

Is there any way, in a WinForms DataGrid, to prevent the user from selecting and deleting rows? Even if I make my DataGrid non-editable (ReadOnly=True), the user can still select one or more rows, press the Delete key, and cause the rows to disappear from view. This doesn't actually do anything in the database, of course, but it's still confusing to the user.

Similarly, in my editable DataGrids, I'd prefer to disable the built-in select-and-delete functionality, and require users to click a Delete button to delete a row. This would prevent deleting multiple rows at once, which I'd like to prevent in some cases.

In the past, I've subclassed the DataGrid and overridden OnCurrentCellChanged to prevent multi-select (by manually de-selecting all but the current row), and ProcessCmdKey to catch the Delete key and Ctrl-A for select-all-rows. This worked (except for catching multi-select with the mouse), but it seemed unnecessarily grizzly.

Does MM.NET offer any alternatives, or is the MM.NET philosophy to have users use the built-in select-and-delete functionality in WinForms DataGrids?

Thanks,
Ric
Next
Reply
Map
View

Click here to load this message in the networking platform