Microsoft KB Archive/814316

= BUG: The DrawCell event of the vsFlexArray and vsFlexGrid controls in Visual Basic 6.0 is not upgraded to Visual Basic .NET or to Visual Basic 2005 =

Article ID: 814316

Article Last Modified on 4/23/2007

-

APPLIES TO


 * Microsoft Visual Basic 2005
 * Microsoft Visual Basic .NET 2003 Standard Edition

-



SYMPTOMS
A project that was created by using Microsoft Visual Basic 6.0 and the Standard EXE project template contains either the vsFlexArray ActiveX control or thevsFlexGrid ActiveX control, and the DrawCell event of the control is defined. After you upgrade the project to Visual Basic .NET 2003, you observe that the DrawCell event is upgraded as follows: 'UPGRADE_NOTE: Left was upgraded to Left_Renamed. Click for more:

'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword=&quot;vbup1061&quot;' Private Sub vsFlexArray1_DrawCell(ByVal hDC As Integer, ByVal Row As Integer,

ByVal Col As Integer, ByVal Left_Renamed As Integer, ByVal Top_Renamed As Integer,

ByVal Right_Renamed As Integer, ByVal Bottom_Renamed As Integer, ByRef Done As Boolean)    Text1.Text = CStr(Row) End Sub However, the code that you expect is the following: Private Sub vsFlexArray1_DrawCell(ByVal eventSender As System.Object,

ByVal eventArgs As AxvsFlexLib._DvsFlexArrayEvents_DrawCellEvent) Handles vsFlexArray1.DrawCell    Text1.Text = CStr(eventArgs.Row) End Sub



CAUSE
The problem occurs because the tool that is used to upgrade has to rename the event parameters in Visual Basic 6.0 because new keywords are used in Visual Basic .NET or in Visual Basic 2005. The upgrade tool does not successfully build the new event signature with an Eventargs parameter in Visual Basic .NET or in Visual Basic 2005. Therefore, this problem occurs in any ActiveX control where the upgrade tool determines that the event parameters must be renamed.



WORKAROUND
To work around this problem, add the DrawCell event to the upgraded code. To add the code, follow these steps:  In the code editor tool, select the DrawCell event for vsFlexArray1 from the Declarations list.  Add the following code to the DrawCell event of vsFlexArray1: Text1.Text = e.row 



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 the Behavior
 Create the Visual Basic 6.0 project:  In Visual Basic 6.0, open a new project. By default, Form1 is created. On the Project menu, click Components. The Components dialog box appears.</li> On the Controls tab, select the :-) VideoSoft vsFlex3 Controls check box, and then click OK.

Note VideoSoft vsFlex Controls are not Microsoft controls. To reproduce the behavior, install the components from the following ComponentOne Web site:http://home.componentone.com/default.aspx</li> On the Toolbox toolbar, double-click the vsFlexArray control.</li> On Toolbox, double-click the TextBox control.</li> On the View menu, click Code.</li>  Add the following code to the DrawCell event of vsFlexArray1: 'Intialize Text1.Text to the Row parameter of DrawCell event Text1.Text = Row </li> Save the project.</li></ol> </li> Upgrade the Visual Basic 6.0 project (that you created in step 1) to Visual Basic .NET or to Visual Basic 2005:  Start Microsoft Visual Studio .NET 2003 or Microsoft Visual Studio 2005.</li> On the File menu, point to Open, and then click Project.</li> Open the Projectname.vbp file that you created earlier.</li> In the Visual Basic Upgrade Wizard, click Next three times.</li> In the Warning message box, click Yes.</li> Click Next to upgrade the project.</li> In Solution Explorer, right-click Form1.vb, and then click View code.

The code appears as mentioned in the &quot;Symptoms&quot; section of this article.</li></ol> </li></ol>

The third-party products that are discussed in this article are manufactured by companies that are independent of Microsoft. Microsoft makes no warranty, implied or otherwise, regarding the performance or reliability of these products.

<div class="references_section">