Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Ctrl+S is DataGrid does not save data
Message
De
01/01/2007 10:14:18
 
 
À
01/01/2007 07:12:21
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Versions des environnements
Environment:
C# 1.1
Divers
Thread ID:
01181178
Message ID:
01181196
Vues:
16
Andrus,

I have found that the .EndCurrentEdit() does not always work. Strangely enough, what seems to work correctly in this case is to Refresh the CurrencyManager. So, your code should look like this:
  case Keys.Control | Keys.S:

    ((CurrencyManager)BindingContext[
				DataSource, DataMember]).Refresh();
    ((BusinessForm)FindForm()).Save();
    break;
~~Bonnie

>I have Winforms C# DataTable bound to DataGrid.
>User edits cell and press Ctrl+S without leaving cell.
>Edited data is not saved to database.
>When user moves to other row, save works OK.
>
>How to save without leaving cell ?
>
>I have the following code in DataGrid subclass :
>
>protected override bool ProcessCmdKey(ref Message msg, Keys keyData) {
> if ((msg.Msg == WM_KEYDOWN) || (msg.Msg == WM_SYSKEYDOWN)) {
>switch (keyData){
>
> case Keys.Control | Keys.S:
>
> ((CurrencyManager)BindingContext[
> DataSource, DataMember]).EndCurrentEdit();
> ((BusinessForm)FindForm()).Save();
> break;
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform