I have a String:
var
vMinhastring : string;
begin
vMinhastring := 'Edit1';
In my form I have a Tedit Compound with the name Edit1. How do I pass some value to my Edit1 by using the aVMinhastring as Component name?
vMinhastring.text := 'batatinha';
I'm trying to do this, but I'm having problems:
contElem := 1;
Rdb1:= TRadioGroup.Create(TabSheet1);
Rdb1.Parent:= TabSheet1;
Rdb1.OnExit := Validacao;
Rdb1.Name:='Rdb'+IntToStr(contElem);
Rdb1.Items.Add('C');
Edit := TMaskEdit.Create(TabSheet1);
Edit.Parent:= TabSheet1;
Edit.Name:='Edit'+IntToStr(contElem);
Edit.Clear;
Edit.EditMask := ('!99;1;');
contElem := 2;
Rdb1:= TRadioGroup.Create(TabSheet1);
Rdb1.Parent:= TabSheet1;
Rdb1.OnExit := Validacao;
Rdb1.Name:='Rdb'+IntToStr(contElem);
Rdb1.Items.Add('C');
Edit := TMaskEdit.Create(TabSheet1);
Edit.Parent:= TabSheet1;
Edit.Name:='Edit'+IntToStr(contElem);
Edit.Clear;
Edit.EditMask := ('!99;1;');
I created a procedure:
procedure TFCad_AnaliseDeTendencias.Validacao(Sender: TObject);
var
name, name2 :string;
i : integer;
begin
name := TRadioGroup(Sender).Name;
name2 := '';
for i := 1 to Length(name) do
begin
if name[i] in ['0'..'9'] then
name2 := name2 + name[i];
end;
name2 := 'Edit'+name2;
TMaskEdit(FindComponent(name2)).Text := '01'; //Esta dando erro aqui.
end;
You are giving
errorAccess violation at address