using the value of a string as a reference to a component


[ Delphi Forum ] [ Delphi Tutorials -- by DelphiLand ]

Posted by p12334 Alex diNorcia on June 19, 2003:

i'm not sure if this can be done, but i'd like to read in a string, and then reference a component from it.

please let me know if this is doable (and an example of it working).

here is a simple example :
var
ident_txt: string;
begin
form1_unit.Form1.Show;
ident_txt := 'form1_unit.Form1.Label1.Caption';

// you can do
form1_unit.Form1.Label1.Caption := 'hello world';

// you CANT do
//(ident_txt) := 'hello world';
// or
//&&ident_txt := 'hello world';
// or something like that

end;





Related Articles and Replies:


[ Delphi Forum ]
[ DelphiLand: free Delphi source code, tips, tutorials ]