Solved

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

Posted on 2011-03-12
2
627 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…

688 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