ICI logo

Intersystem Concepts, Inc.

VB6 Ubound Crash

Rarely do VB6-created programs crash, that is, terminate execution and close themselves if they have error checking enabled.

We had one program that would do this when compiled with No optimization, then run under Windows XP. We narrowed the problem to a section of code invoving an integer array. Small modifications to the code would result in the program running under XP, but crashing under later versions of Windows.

The problem code employed the ubound() function on a static array within a dynamic array of a User Defined Type. When we replaced ubound() with a constant equal to the the upper limit of the static array, the problem disappared on all versions of Windows.

Other VB tips