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 (814316)



The information in this article applies to:

  • Microsoft Visual Basic 2005
  • Microsoft Visual Basic .NET (2003)

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="vbup1061"' 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:
  1. In the code editor tool, select the DrawCell event for vsFlexArray1 from the Declarations list.
  2. 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.

MORE INFORMATION

Steps to Reproduce the Behavior

  1. Create the Visual Basic 6.0 project:
    1. In Visual Basic 6.0, open a new project. By default, Form1 is created.
    2. On the Project menu, click Components. The Components dialog box appears.
    3. 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
    4. On the Toolbox toolbar, double-click the vsFlexArray control.
    5. On Toolbox, double-click the TextBox control.
    6. On the View menu, click Code.
    7. Add the following code to the DrawCell event of vsFlexArray1:
      'Intialize Text1.Text to the Row parameter of DrawCell event 
      Text1.Text = Row
    8. Save the project.
  2. Upgrade the Visual Basic 6.0 project (that you created in step 1) to Visual Basic .NET or to Visual Basic 2005:
    1. Start Microsoft Visual Studio .NET 2003 or Microsoft Visual Studio 2005.
    2. On the File menu, point to Open, and then click Project.
    3. Open the Projectname.vbp file that you created earlier.
    4. In the Visual Basic Upgrade Wizard, click Next three times.
    5. In the Warning message box, click Yes.
    6. Click Next to upgrade the project.
    7. In Solution Explorer, right-click Form1.vb, and then click View code.

      The code appears as mentioned in the "Symptoms" section of this article.
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.

REFERENCES

For more information, visit the following MSDN web site:

Modification Type:MinorLast Reviewed:10/3/2006
Keywords:kbvs2005swept kbvs2005applies kbMigration kbUpgrade kbEvent kbWindowsForms kbCtrl kbControl kbActivexEvents kbbug KB814316 kbAudDeveloper