Microsoft KB Archive/272400

= BUG: Application Error Returns Resized Array to Event Procedure =

Article ID: 272400

Article Last Modified on 10/15/2002

-

APPLIES TO


 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition

-



This article was previously published under Q272400



SYMPTOMS
When you attempt to assign the return value of a function to an event procedure array argument, an Application Error occurs if the function returns an array that is not the same size as the array argument in the event procedure.



RESOLUTION
To work around this behavior:
 * a temporary array can be used as the return for the function and the array argument can be resized in the event procedure.

-or-


 * the array in the function can be re-dimensioned to the same size as the array in the event procedure.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.



Steps to Reproduce Behavior
 Start a new Visual Basic Standard EXE project. Form1 is created by default. On the Project menu, select Components. In the Components dialog box, select the Microsoft Windows Common Controls-2 6.0 component, and then click OK. Add a MonthView control to Form1.  Add the following code to the General Declarations section of Form1: Private Sub MonthView1_GetDayBold(ByVal StartDate As Date, ByVal Count As Integer, State As Boolean) State = ChangeArray(UBound(State)) End Sub

Function ChangeArray(UpperBound As Integer) Dim aryNew As Boolean 'Uncomment the following line to examine a workaround. 'ReDim aryNew(UpperBound) As Boolean ChangeArray = aryNew End Function  Press the F5 key to run the program and note that an Application Error occurs.</ol>

Keywords: kbbug kbcmnctrls kbmonthcalctrl kbctrl kbpending KB272400

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.