Solved

Syntax for entering a value into a variable fieldname using Delphi 5 dbgrid

Posted on 2011-03-12
2
618 Views
Last Modified: 2012-05-11
The problem. I have a popup calculator that I use to calculate the value to enter into a dbgrid. It works well for a specified field but I want it to work for any field identified by the column fieldname.

Eg:
field_name_variable := dbgrid.fieldname (for the current column)
value_variable := [some calculated result from the popup calculator]
tablename.field_name_variable.value := value_variable.

I do not know the syntax for assigning the fieldname from the field_name_variable.
0
Comment
Question by:THiggins73
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 32

Accepted Solution

by:
Ephraim Wangoya earned 500 total points
ID: 35118940
Use fieldbyname
field_name_variable := dbgrid.fieldname (for the current column)
value_variable := [some calculated result from the popup calculator]

tablename.edit;
tablename.FieldByName(field_name_variable).Value := value_variable.
tablename.post;

Open in new window

0
 

Author Closing Comment

by:THiggins73
ID: 35143799
Thank you for your prompt response.
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi application Soap connection 5 131
Correct Component for Shopping Cart. 2 120
TServerSocket - file via sendbuf or Text via sendtext ? 1 76
control image tags in a string ? 12 153
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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

735 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