DelphiBasics
Abort
Procedure
Aborts the current processing with a silent exception SysUtils unit
 procedure Abort ;
Description
The Abort procedure stops the current processing and exits to the last exception block. In doing so, no end user message is produced - the abort is silent.
Related commands
Break Forces a jump out of a single loop
Continue Forces a jump to the next iteration of a loop
Goto Forces a jump to a label, regardless of nesting
Halt Terminates the program with an optional dialog
RunError Terminates the program with an error dialog
 Author links

 Buy Website Traffic at
 Buywebsitetrafficexperts.com

 Buy Proxies at
 Buyproxies.io
 
 Download this web site as a Windows program.




 
Example code : Aborting from a try block
// Full Unit code.
// -----------------------------------------------------------
// You must store this code in a unit called Unit1 with a form
// called Form1 that has an OnCreate event called FormCreate.
 
unit Unit1;
 
interface
 
uses
  SysUtils,   // Unit containing the Abort command
  Forms, Dialogs;
 
type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
  end;
 
var
  
Form1: TForm1;
 
implementation
{$R *.dfm} // Include form definitions
 
procedure TForm1.FormCreate(Sender: TObject);

begin
  // Enter a try block
  Try
    ShowMessage('Before abort');
    Abort;
    ShowMessage('After abort');
  Except
    On E : Exception do ShowMessage(E.Message + ' exception occured');
  end;
  ShowMessage('After try');
end;
 
end.
Hide full unit code
   Before abort
   Operation aborted exception occured
   After try
 
Delphi Programming Neil Moffatt 2002 - 2017. All rights reserved.  |  Home Page