Solved

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

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

Suggested Solutions

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
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…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

734 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