Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grid 1
Message
From
25/07/2008 09:59:46
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
25/07/2008 09:28:17
Muthu Vel
Sty Company
India
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Re: Grid 1
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01334052
Message ID:
01334067
Views:
14
>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)
  • Previous
    Reply
    Map
    View

    Click here to load this message in the networking platform