From Xojo Documentation
Occurs when code tries to access an array element that doesn't exist.
An OutOfBoundsException error occurs when your code uses an array index that is out of range. This occurs, for example, if you forget that arrays are zero-based and you make an error when you try to access the last element.
This example is supposed to display the fonts installed on the user's computer in a ListBox. It generates an OutOfBoundsException because the loop should be from 0 to nFonts-1 rather than from 1 to nFonts. When the loop gets to nFonts, the value of i is out of range and the error occurs.
If you run this code in a built application, you will see a generic error message when i reaches the value of nFonts:
An exception of class OutOfBoundsException was not handled. The application must shut down.
You can handle the exception by adding the following code:
nFonts = FontCount
For i = 1 To nFonts
If err IsA OutOfBoundsException Then
MsgBox("The value: " + Str(i) + " is out of range!")
When this code runs in a built application, the user sees a dialog box that gives the value of the out of range number. The application does not quit when the user accepts the dialog box.