I get the “Undeclared identifier” in a pprocedure I created called submit.
procedure submit;
begin
if ebMain.Text='exit' then
fmMain.Close;
end;
Really simple. The compiler tells me ebMain is undeclared. I ca fix this by putting “fmMain.” in front of it but I never had to do this in delphi 7.The edit box(ebMain) is on the main form(fmMain). The procedure header is placed just under the “uses”. What’s wrong?
submit()is not a member of yourTfrmMainclass, so it does not know whatebMainis. You need to either:1) make
submit()be a member of your form’s class (which you should do anyway because all it is doing is accessing members ofTfrmMain):2) prefix
ebMainwith the form’s globalfrmMainvariable (like you are already doing forClose()):Yes, you would have had to do this in every version of Delphi, including D7.