visionetv
asked on
Use Delphi to add an integer to a Tedit name
Hi Experts;
Is it possible to add an integer to the name of a TEdit component from a loop? I'm trying to add an integer to the name of a number of edit boxes that contain various .text strings so I can iterate through the group and compare their text to a another string in another edit box... something like this:
For n := 1 to 40 do
begin
If Edit+IntToStr(n)+.text = Editbox1.text then
begin
(ShowMessage Edit+IntToStr(n) + 'is a match')
end;
The above of course does not work. There must be a way to do what should be a simple string comparison operation but apparently my approach is on the wrong track; any help would be appreciated.
Thank you,
Visionetv
Is it possible to add an integer to the name of a TEdit component from a loop? I'm trying to add an integer to the name of a number of edit boxes that contain various .text strings so I can iterate through the group and compare their text to a another string in another edit box... something like this:
For n := 1 to 40 do
begin
If Edit+IntToStr(n)+.text = Editbox1.text then
begin
(ShowMessage Edit+IntToStr(n) + 'is a match')
end;
The above of course does not work. There must be a way to do what should be a simple string comparison operation but apparently my approach is on the wrong track; any help would be appreciated.
Thank you,
Visionetv
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
MerijnB;
Thank you - application checks for duplicate entries in a Purchase Order form where all the fields are edit boxes. The form can have up to forty entries, so speed is not a problem.
Thanks again,
Visionetv
Thank you - application checks for duplicate entries in a Purchase Order form where all the fields are edit boxes. The form can have up to forty entries, so speed is not a problem.
Thanks again,
Visionetv
Instead of:
EditBox1: TEdit;
EditBox2: TEdit;
EditBox3: TEdit;
Use:
EditBox: array[1..3] of TEdit;
as a Public declaration.
Then use EditBox[n] in your program.
It's a while since I've used Delphi but hopefully this will point you in the right direction.