I have 10 TEdits and 10 images and I tried to use this:
procedure TForm1.Button1Click(Sender: TObject; edit: TEdit);
var i:integer;
begin
for i:= 1 to 10 do
begin
if edit[i].text:='1' then picture[i].Show else picture[i].Hide;
end;
end;
But delphi returns this error: [Error] Unit1.pas(84): Class does not have a default property
I also tried this:
procedure TForm1.Button1Click(Sender: TObject);
var i:integer;
begin
for i:= 1 to 10 do
begin
if edit[i].text:='1' then picture[i].Show else picture[i].Hide;
end;
end;
But, again, Delphi returns errors:
[Error] Unit1.pas(84): Undeclared identifier: 'edit'.
Can you help me with this code?
:=is the assignment operator,=is comparison. Be sure not to confuse these. It seems you have not declared any arrays namededitorpicture. If you want to access your controls in an array you need to declare those arrays and then place references to the controls in them. Also note that you cannot change the method signature of aTNotifyEvent- it must have only one parameter (Sender : TObject).