Resume statement - MapBasic - 2023

MapInfo MapBasic Reference

Product type
Software
Portfolio
Locate
Product family
MapInfo
Product
MapInfo > MapBasic
Version
2023
Language
English
Product name
MapBasic
Title
MapInfo MapBasic Reference
First publish date
1985
Last updated
2023-09-12
Published on
2023-09-12T16:32:32.686312

Purpose

Returns from an OnError error handler.

Syntax

Resume { 0 | Next | label } 

label is a label within the same procedure or function.

Restrictions

You cannot issue a Resume statement through the MapBasic window.

Description

The Resume statement tells MapBasic to return from an error-handling routine.

The OnError statement enables an error-handling routine, which is a group of statements MapBasic carries out in the event of a run-time error. Typically, each error-handling routine includes one or more Resume statements. The Resume statement causes MapBasic to exit the error-handling routine.

The various forms of the Resume statement let the application dictate which statement MapBasic is to execute after exiting the error-handling routine:

A Resume 0 statement tells MapBasic to retry the statement which generated the error.

A Resume Next statement tells MapBasic to go to the first statement following the statement which generated the error.

A Resume label statement tells MapBasic to go to the line identified by the label. Note that the label must be in the same procedure.

Example

...
	OnError GoTo no_states
	Open Table "states"
	Map From states
after_mapfrom:
... 
	End Program 
no_states:
	Note "Could not open States; no Map used."
	Resume after_mapfrom

See Also:

Err() function, Error statement, Error$() function, OnError statement