Solved

DBGrid Field value

Posted on 2006-11-01
9
1,245 Views
Last Modified: 2012-05-05
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.
0
Comment
Question by:cmwong
  • 4
  • 2
  • 2
  • +1
9 Comments
 
LVL 1

Expert Comment

by:ruanlab123
ID: 17855855
On the Field1 OnChange property, just set the value of field2 in the query your are using for your DBGrid.
0
 

Author Comment

by:cmwong
ID: 17856112
Dear ruanlab123,

Sorry, in the DBGrid field property don't have the onChange Property..
0
 
LVL 11

Expert Comment

by:calinutz
ID: 17856124
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
 
LVL 11

Expert Comment

by:calinutz
ID: 17856130
Or, as suggested in the same PAQ, try using the OnColExit event and enter there the code for updating the dataset.
Regards
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 1

Expert Comment

by:ruanlab123
ID: 17856139
Sorry the DBGrid onChange event not property.
0
 
LVL 11

Expert Comment

by:Goodangel Matope
ID: 17856781
listening...
0
 

Author Comment

by:cmwong
ID: 17856936
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
 
LVL 11

Accepted Solution

by:
calinutz earned 250 total points
ID: 17859827
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
 
LVL 11

Expert Comment

by:calinutz
ID: 17864897
Why grade C?
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now