Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Grid 1
Message
De
25/07/2008 09:59:46
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
25/07/2008 09:28:17
Muthu Vel
Sty Company
Inde
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Re: Grid 1
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01334052
Message ID:
01334067
Vues:
13
>I have a student table.dbf, having five fields.
>
>I have create emp entry.scx. In that I have placed five text boxes, one Grid control, one command button.
>
>I have enter the data in the text boxes and click command button the entered record will dispaly in the Grid and same time save in main
> student.dbf.
>
>How to write the code?

The best solution is to connect your TextBoxes directly to the table. Use the .ControlSource property for each TextBox, to bind them to the corresponding field.

If you want to give the user the ability to save and undo changes, you should use buffering. For example, you might read my introductory article on buffering, Universal Thread Magazine, July 2002.

In summary:
  • Enable buffering with CursorSetProp("Buffering") (or directly in the Data Environment). Use optimistic buffering (option 3 or 5).
  • Save changes with TableUpdate(). Be sure to check the return value: perhaps the record can't be saved for different reasons.
  • Undo changes with TableRevert().

    Also, whenever you go to another record, you have to update the TextBoxes with a command like ThisForm.Refresh().

    HTH,

    Hilmar.
    Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
  • Précédent
    Répondre
    Fil
    Voir

    Click here to load this message in the networking platform