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

Change data in TDbgrid

Status
Not open for further replies.

MerryMadDad

Programmer
Dec 11, 2001
47
GB
Hello all,

I created a db in ms access and exported it as Dbase 5 then used this as the table in Database wizard in Delphi 4.0 displayed in a grid.

Now I want to change the data displayed in the grid (all string type) for example using a button how do i change a single cell in the tdbgrid from 5 to 4 ?

I need to be able to select the cell first - don't know how to do this as there are many columns and many rows in the tdbgrid.

Then change the value of the contents

I have checked thread102-304477 but did not understand it ! as I know next to nothing about database programming

Any help much appreciated
 
If I follow you want to programmatically change a value?

If so rather than change the value in the grid, you want to change the value in the table which the grid is displaying.

To do this:
tablename.edit;
tablename.fieldbyname('fieldname you want to change').AsInteger := new value for field;
tablename.post; Robertio
Alias: Robbie Calder
Software Developer
urc@walkermartyn.co.uk
 
Some points;
1) Delphi reads access tables, there is no need to export to DBase or Paradox

2) How to use Look Up fields with Tables /Queries
faq102-1212 has some database definitions

3)How to select a cell in a certain column? Check out How to use multi-colored lines in a grid
faq102-2416

Regards Steven van Els
SAvanEls@cq-link.sr
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top