How to delete event handler in Delphi?

Question

How to delete event handler in Delphi?

Re: How to delete event handler in Delphi?

To quickly delete an event handler, simply delete the text from between the keywords begin and end. If there are declarations before the keyword begin (like const, var, type), also delete these. Let's say that you have an event handler that looks like this:
procedure TFormMain.Button1Click(Sender: TObject);
var
S: string;
begin
S := '123';
Label1.Caption := 'Testing... ' + S;
Edit1.Text := S;
end;
After removing the text:
procedure TFormMain.Button1Click(Sender: TObject);
begin
end;
Next, compile the project... and automagically, Delphi has completely removed the event-handler. Not only from the interface section, but also from the implementation and from the form-file (the .dfm file). That's a lot easier and quicker than manually removing all this stuff!