From: Robert <rcram@knoware.nl>
Subject: Re: [delphi] Creating Object names from variables
Date: Thu, 10 Aug 1995 10:47:09 +0200

>I have an app which utilises various components depending on 
>selections made by the user (say by entering a number 1 to 6). Each 
>of the components is named Edit1, Edit2 etc. How can I refer to these 
>components by combining the 'generic' component name eg 'Edit' with a 
>variable, sort of
>
>pick : = 3;
>(Edit + IntToStr(pick)).Text := 'You picked this one';
>
>Russell Weetch


I think the easiest solution would be to use the following function (applies to all components, so you can use it for your form)

function FindComponent(const AName: string): TComponent

Your code would look something like:

pick : = 3;
TEdit(FindComponent(Edit + IntToStr(pick))).Text := 'You picked this one';

Hope this helps,
Robert.
