> > Hallo,> > I want to make some modules on my program can manipulate (adding,editing,deleting) some data/records of database files from/using Grid Component. > > What should I do?> > > > Cheers,> > Ellen> Create a new form. RightClick on the form and select Data Environment. Add your table to the data environment. Drag and drop the entire table from the Data Environment onto the form. It will create the default grid for you.> > If you drag & drop a field from the table to the form, it will create a textbox for that field.> > KTB

Hi,Grids are lots of fun....lol

There are two ways of handling what you are asking.

First way======Have a seperate set of command buttons on your form to add data into the grid.This is not hard to do. Set your grid as a default as readonly=.t.You click on and Add, or Edit button set the grid for readonly=.f.With add - Append blank and issue Thisform.Refreshand set the focus to the gird object you wish the user to start inputing at.

With Edit, same idea. Set the grid to readonly=.f. and set the focus.

Since the user has the ability to move up and down in the grid and maychange more than one record, ensure the cursor is set for buffering = 5and with the tableupdate command make sure you use the following:=TABLEUPDATE(.T.) to force all changed in the table to the backend.

You can use the valid event to ensure data is entered as it should be,or with a Save command button test for input and set the focus backto the grid object that is lacking, or in error.

Second Way========Use the dbf() to logical decide what table you are accessing. So ifclicking in the grid the dbf() will return that table name. Paln yourlogic based upon this. If a parent table is being used, clicking onthat object will return via the dbf() the table being changed andplan your logic based upon this return.

I personally like the seperate command buttons; one set for the parentand one for the grid to remove any user issues.

Pete from the Great White North. (Only in Canada, ay.) Over and Out ...