Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

values from form textbox to grid

Status
Not open for further replies.

sun11

Programmer
Dec 22, 2009
21
0
0
GB
Hi,

I have a form and a grid and I want to replace all the data from the form textbox to the grid. How can I do that ..

thanks,
Sun11
 
What do you mean exactly?
Simply set controlsources of your textbox controls to be the same as your grid columns' controlsources and use buffering.





Cetin Basoz
MS Foxpro MVP, MCP
 
hi cetin,


I have a form in which I search using the ID. Once I found the ID in the table there are title, artist which fills from the table. After the search operation I want to store the values of the form in a grid so I kept a button but not able to know how to pass the values from the text box to the grid

Thanks,
Sun11
 
A Grid is a bunch of controls for a whole table/alias, a textbox is a single field control. The grid does not work like an excel sheet with cells, but rather like a browse.

So what you typically do is bind the grid to a table (rowsource) and a textbox to some field of the same table (controlsource) then you can navigate to a record in the grid, type in something into the textbox and thereby edit the grid.

Or you keep the textboex unbound, then for example use an insert-SQL to add the new values to a new record.

eg in the add button click do INSERT INTO thealias (thefield) VALUES (thisform.text1.value) and THISFORM.grid1.refresh()

thealias should be the aliasname of the table you want to add to and which is displayed by the grid.

Bye, Olaf.
 
If I misunderstand, I apologize.

A GRID has a ControlSource. That is a Cursor or a Table.

The TextBoxes also have ControlSources. They can either be bound to cursor/table fields or they can be independent memory variables.

If the TextBoxes are bound to a cursor/table, the values entered will be automatically entered into its associated table (depending on the table buffering method used). If the Grid is using this same table for its ControlSource, then no problem - Done.

If the TextBoxes are using memory variables, then you can enter a new record and utilize REPLACE to populate the associated fields. After which you would probably do a ThisForm.Grid1.Refresh to ensure that the data was displayed.

Good Luck,
JRB-Bldr
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top