LotusScript for Visual Basic Programmers - IBM Redbooks
LotusScript for Visual Basic Programmers - IBM Redbooks
LotusScript for Visual Basic Programmers - IBM Redbooks
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Error Checking<br />
There are two types of error checking per<strong>for</strong>med in the script editor:<br />
1. Each time you move the cursor to a different line, by pressing ENTER,<br />
using a cursor movement key, or clicking with the mouse, Notes will<br />
check the syntax of that line in isolation. This kind of syntax check picks<br />
up errors such as unmatched parentheses and incomplete expressions.<br />
Notes does not <strong>for</strong>ce you to fix these errors right away. You can<br />
continue entering code. However, Notes will not allow you to save the<br />
<strong>for</strong>m until the error is corrected.<br />
2. Whenever you save the <strong>for</strong>m, Notes will compile the <strong>LotusScript</strong> code,<br />
and may uncover other errors, such as a Select Case statement with no<br />
matching End Select statement, and invocations of methods which the<br />
object does not support. When such a compile error is found, Notes will<br />
display the following message box:<br />
Testing the Form<br />
If you click Yes, the <strong>for</strong>m is not saved and you can go and edit the code<br />
to correct the error. If you click No, the <strong>for</strong>m is not saved and any<br />
changes you made since the last successful save are lost.<br />
Choosing Design → Test Form will cause the <strong>for</strong>m to be saved, and a new<br />
document created based on the <strong>for</strong>m. You can then run this new document<br />
through its paces to check on how the code you wrote <strong>for</strong> the <strong>for</strong>m is<br />
per<strong>for</strong>ming. When you complete your testing, press ESC (Notes will ask you<br />
if you want to save the document) to take you back to the <strong>for</strong>m design IDE.<br />
Debugging <strong>LotusScript</strong><br />
It is possible that all of your <strong>LotusScript</strong> statements are syntactically correct,<br />
and that your program compiles without error, and yet it will not run<br />
correctly. Consider this very simple code fragment:<br />
If A + B Then C = 0<br />
What the programmer meant to type is<br />
If A = B Then C = 0<br />
but in haste, the SHIFT key was not released in typing the equals sign, and<br />
the plus sign was typed instead. Both statements are syntactically correct,<br />
40 <strong>LotusScript</strong> <strong>for</strong> <strong>Visual</strong> <strong>Basic</strong> <strong>Programmers</strong>