Solved

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

Posted on 2011-03-12
2
609 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
2 Comments
 
LVL 32

Accepted Solution

by:
ewangoya 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

ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

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…
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

770 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