Passing a variable like that is the right way. Not sure why you have the sender in the parameter list, unless it is a default event. Some more information on the structure of your code may shed some light on the situation.
pritaeas
Posting Expert
5,480 posts since Jul 2006
Reputation Points: 653
Solved Threads: 874
Tlistname = class(TForm)
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
public
procedure much_reuseable_code(AChoice: Integer);
end;
procedure Tlistname.Button1Click(Sender: TObject);
begin
much_reuseable_code(1);
end;
procedure Tlistname.Button2Click(Sender: TObject);
begin
much_reuseable_code(2);
end;
procedure Tlistname.much_reuseable_code(AChoice: Integer);
begin
end;
pritaeas
Posting Expert
5,480 posts since Jul 2006
Reputation Points: 653
Solved Threads: 874