FIX: Choose Function Incorrectly Uses Option Base Setting (143115)
The information in this article applies to:
- Microsoft Visual Basic Standard Edition, 32-bit, for Windows 4.0
- Microsoft Visual Basic Professional Edition, 16-bit, for Windows 4.0
- Microsoft Visual Basic Professional Edition, 32-bit, for Windows 4.0
- Microsoft Visual Basic Enterprise Edition, 16-bit, for Windows 4.0
- Microsoft Visual Basic Enterprise Edition, 32-bit, for Windows 4.0
This article was previously published under Q143115 SYMPTOMS
A Visual Basic program using the Choose function incorrectly returns the
wrong value if the program sets the Option Base to a 1.
RESOLUTION
The following are the ways to work around this issue:
- Add 1 to the index argument.
- Create the following function in a module. Copy the following code to
the code window of the module:
Option Explicit
'This function will be used in place of the built in Choose function
'and this takes the setting of Option Base into account.
Public Function Choose(i As Integer, ParamArray a())
Choose = a(i + LBound(a) - 1)
End Function
STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed
at the beginning of this article. This bug has been fixed in Visual Basic
5.0.
Modification Type: | Major | Last Reviewed: | 12/9/2003 |
---|
Keywords: | kbbug kbfix KB143115 |
---|
|