Solved

DBGrid Field value

Posted on 2006-11-01
9
1,243 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
Comment Utility
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
Comment Utility
Dear ruanlab123,

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

Expert Comment

by:calinutz
Comment Utility
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
Comment Utility
Or, as suggested in the same PAQ, try using the OnColExit event and enter there the code for updating the dataset.
Regards
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 1

Expert Comment

by:ruanlab123
Comment Utility
Sorry the DBGrid onChange event not property.
0
 
LVL 11

Expert Comment

by:Goodangel Matope
Comment Utility
listening...
0
 

Author Comment

by:cmwong
Comment Utility
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
Comment Utility
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
Comment Utility
Why grade C?
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This video discusses moving either the default database or any database to a new volume.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

744 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

16 Experts available now in Live!

Get 1:1 Help Now