Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to addrecords to grid when user has entered last row
Message
From
11/04/2002 13:24:15
Walter Meester
HoogkarspelNetherlands
 
 
To
11/04/2002 09:13:30
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00643689
Message ID:
00643847
Views:
10
Hi rajesh,

Set the allowAddnew property of the grid to .T.

Then the users can add new records just by entering the down arrow on the last row.

To prevent more than one row to be added, you must check in the BeforeRowColchange if the current row is empty and issue a TABLEREVERT() if it is. To refresh the grid you might need to get the focus off the grid and inmediately after back on. In any cases use table buffering for grids.

In my cases I have defined a keyfield property on the gridclass, which contains an expression of fields in the grid, If it evaluates to False, I delete the current row when it loses focus (programmed in the valid event). In this way I could define which fields are required fields.

In the local view you should set defaultvalues. But becarefull. VFP6 has got a bug which prevents default values in a localview to be saved to the table. You can workarround it by explicitely use SETFLDSTATE(MyField,4,MyLacalViewAlias) to force VFP to write these values with an TABLEUPDATE().

I guess, you'll need to write all this in a class to get it to work. Though I could post my class, it contains too many references to other parts of my personal framework and will likely to cause more confusion than that it really helps.

Good luck,

Walter,




>how to addrecords to gird when user has entered last row?
>I use grids to display the details on invoice.
>The record source is a local view with parameters from header file.
>Now I use F2 key to add new row to grid.
>The customer wants that a new record be added when he has completed the lastrow.
>If the added row must be added if any data is entered in it.
>
>Rajesh
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform