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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display selected record from DataGrid in text boxes

Status
Not open for further replies.

jbradley

Programmer
Sep 7, 2001
248
US
I have a datagrid which I populate from an open ADO recordset built from a query against a SQL table. I would like to be able to click on a record in the datagrid and have the fields populate a set of text boxes where the user could edit the data and update the table. Could someone suggest how to go about getting the selected data in the datagrid into the text boxes and then back to the table?

Thanks...
 
Why not allow the user to make updates directly on the grid. Set the grid's .AllowUpdate property to true. Thanks and Good Luck!

zemp
 
Allowing the user edit the datagrid can be a dangerous thing, many users don't know how to operate the datagrid in a add,edit,delete mode you will find that records are added that are blank or edited mistakenly.

Use the ID field from the datagrid in the WHERE clause in another recordset, then populate your text boxes with that.

Do your editing on the text boxes and save then refresh your recordset that the datagrid is bound to.

It's alittle bit more involved then this but this is the main idea.

Deke2
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top