Solved

DBGrid Field value

Posted on 2006-11-01
9
1,247 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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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
 
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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi Dbf export problem to a Visual Foxpro application 6 207
code issue 8 153
Printing problem 2 101
Delphi problems to abort a printjob 9 24
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…

808 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