Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
WinForms DataGrid delete
Message
De
07/10/2004 20:24:53
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Titre:
WinForms DataGrid delete
Divers
Thread ID:
00949754
Message ID:
00949754
Vues:
85
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform