18.01.2013 Views

LotusScript for Visual Basic Programmers - IBM Redbooks

LotusScript for Visual Basic Programmers - IBM Redbooks

LotusScript for Visual Basic Programmers - IBM Redbooks

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

MessageBox<br />

<strong>Visual</strong> <strong>Basic</strong> developers will note the MessageBox statement in the<br />

preceding code. <strong>LotusScript</strong> defaults to using MessageBox rather than<br />

MsgBox, although the latter command actually works as well in Lotus<br />

Notes. Ported MsgBox statements will work, using the parameters specified<br />

<strong>for</strong> MessageBox.<br />

<strong>Visual</strong> <strong>Basic</strong>’s message box statement adds support <strong>for</strong> two new<br />

parameters; a helpfile file name and helpcontext id. These are used to refer<br />

to a specific help topic within the named helpfile, if the user pushes F1 <strong>for</strong><br />

help over the message box at run time.<br />

<strong>LotusScript</strong> allows you to make the MessageBox dialog an application<br />

modal or system modal dialog. With <strong>Visual</strong> <strong>Basic</strong>, it is always an<br />

application modal dialog.<br />

Constants<br />

Both <strong>LotusScript</strong> (with LTSSL30.LSS and LSCONT.LSS) and <strong>Visual</strong> <strong>Basic</strong><br />

(WIN16API.TXT and WIN32API.TXT) provide a number of plat<strong>for</strong>m<br />

specific constants and Application Programming Interface (API)<br />

declarations in a standardized <strong>for</strong>mat. <strong>Visual</strong> <strong>Basic</strong> extends this idea by<br />

bundling a number of the constants into the development environment,<br />

providing several useful features:<br />

Teams do not have to guess at a naming sequence <strong>for</strong> constants as they<br />

add them to their projects.<br />

Code becomes easier to share.<br />

The space wasted by unused constants is eliminated.<br />

Examples of this include the vbHourglass and vbYesNo internal constants.<br />

Errors, Error Constants<br />

Both <strong>Visual</strong> <strong>Basic</strong> and <strong>LotusScript</strong> define constants that map to trappable<br />

internal error codes, that may occur at run time. Both languages allow you<br />

to handle system, OLE and data access errors using code-based error<br />

handling routines at run time. The <strong>Basic</strong> On Error statement provides the<br />

means to trap <strong>for</strong> these errors. Having both languages represent the same<br />

type of internal errors with the same numbers is an important step in being<br />

able to share code from one of the BASIC implementations to the other.<br />

As an example, a “Device Unavailable” error occurs if your application tries<br />

to write to a drive that is not ready. This will happen if you try to copy files<br />

to the floppy A: drive without a diskette in this drive. Rather than simply<br />

displaying a system error message and ending the application, <strong>Visual</strong> <strong>Basic</strong><br />

and <strong>LotusScript</strong> treat this as a trappable error, and each gives the developer<br />

Chapter 1: <strong>LotusScript</strong> and <strong>Visual</strong> <strong>Basic</strong>: A Comparison 13

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!