DBGrid Field value

Dear Experts,

I have a DBGrid where Field2 value will depends on the Field1 value. If Field1 value change, the field2 value will change also. and the Field1 has picklist.

Can anybody tell me how to do it?

Thanks.
cmwongAsked:
Who is Participating?
 
calinutzConnect With a Mentor Commented:
Another ideea would be to add all Fields of the Query or table that you use as DataSource. (Click on table and in Object  TreeView, select the query you use, right-click on the Fields and pick Add All Fields) And use the field's event OnSetText... or OnChange, or OnValidate... Try them all, at least one of them should work
I did not try them myself... so good luck. They all seem to do what you need. So in case of a change in a certain record field... do something... change the other field that you want to change.

regards
0
 
ruanlab123Commented:
On the Field1 OnChange property, just set the value of field2 in the query your are using for your DBGrid.
0
 
cmwongAuthor Commented:
Dear ruanlab123,

Sorry, in the DBGrid field property don't have the onChange Property..
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
calinutzCommented:
Write an onChange event for your DBGrid. Try the example found at this PAQ:
http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_20842900.html

Cheers
:-)
0
 
calinutzCommented:
Or, as suggested in the same PAQ, try using the OnColExit event and enter there the code for updating the dataset.
Regards
0
 
ruanlab123Commented:
Sorry the DBGrid onChange event not property.
0
 
Goodangel MatopeSoftware ArchitectCommented:
listening...
0
 
cmwongAuthor Commented:
Dear calinutz,

I am using the onChange event as you say, however the field is a picklist.. when i change the field1 value using the the picklist, the field2 value does change..but the field1 value remain the same.. I don't understand why?

Thanks.
0
 
calinutzCommented:
Why grade C?
0
All Courses

From novice to tech pro — start learning today.