Link to home
Start Free TrialLog in
Avatar of pketeldijk
pketeldijk

asked on

DBGrid question

How can I in a DDBGrid if a user enters a word in one fieldname that
another word goes automatically in another fieldname?

for example, if a user enters 'A' in fieldname 1 then
automatically 'B' goes in fieldname 2
ASKER CERTIFIED SOLUTION
Avatar of snehanshu
snehanshu

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of snehanshu
snehanshu

Oops, you'll need to include DB in the uses clause and change the if condition to

If DBGrid1.DataSource.DataSet.FieldByName('MyField').AsString = 'A' then

-> NOT :=
...Shu
You Can Change the value of the next column be changing it's data in related dataset.

in  OnColExit Or OnKeyPress events write a simple code like:

DBGrid1.DataSource.DataSet.Edit;
DBGrid1.DataSource.DataSet.[Filed to be changed]=a new value;
DBGrid1.DataSource.DataSet.Post;
DBGrid1.Refresh;