The user control array is not painted on the form after you upgrade your Visual Basic 6.0 project (814743)



The information in this article applies to:

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

SYMPTOMS

After you upgrade your Microsoft Visual Basic 6.0 project with a user control array to Microsoft Visual Basic .NET or Microsoft Visual Basic 2005, the user control array is not painted on the form. This problem occurs only when you open the form in design mode, and you do not build the project after you upgrade to Visual Basic .NET or Visual Basic 2005.

CAUSE

The user control on the form is drawn only when the compiled version of the user control exists. The Upgrade Wizard only upgrades the user control file (.ctl) to a Visual Basic .NET or Visual Basic 2005 file (.vb). The Upgrade Wizard does not create a compiled version of the user control. Without the compiled version of the user control, the array of the user control does not appear on the form.

RESOLUTION

To resolve the problem, rebuild the project, and then open the Windows form, as follows:
  1. Close Form1.
  2. On the Build menu, click Rebuild Solution.
  3. In Solution Explorer, double-click Form1 to open the Windows form.

    The user control array is on the form.

STATUS

This behavior is by design.

MORE INFORMATION

Steps to Reproduce the Behavior

  1. Start Visual Basic 6.0, and then create a new Standard EXE project.
  2. On the Project menu, click Add User Control, and then click Open.

    UserControl1 is added.
  3. On the toolbox, add a TextBox to UserControl1, and then close UserControl1.

    Usercontrol1 is added to the toolbox.
  4. Click to select Form1.
  5. On the toolbox, double-click UserControl1 to add a control to Form1.
  6. Right-click the control on Form1, and then click Copy.
  7. Right-click Form1, and then click Paste.
  8. Click Yes on the dialog box that prompts you to create a control array.
  9. Repeat step 7.
  10. On the File menu, click Save Project As to save the project.
  11. Open Microsoft Visual Studio .NET or Microsoft Visual Studio 2005.
  12. On the File menu, point to Open, and then click Project.
  13. Move to the Visual Basic 6.0 project that you created, and then click Open.

    Visual Basic Update Wizard is displayed.
  14. Click Next three times. When a Warning message is displayed, click Yes, and then click Next to upgrade to Visual Basic .NET or Visual Basic 2005.
  15. In Solution Explorer, double-click Form1.vb to open Form1.

    The behavior mentioned in the "Symptoms" section of this article occurs.

REFERENCES

For more information, visit the following MSDN Web site:

Upgrading Applications Created in Previous Versions of Visual Basic
http://msdn.microsoft.com/library/en-us/vbcon/html/vbconupgradingapplicationscreatedinpreviousversionsofvisualbasic.asp

Modification Type:MinorLast Reviewed:10/3/2006
Keywords:kbvs2005swept kbvs2005applies kbDesigner kbDLL kbCompiler kbUpgrade kbWindowsForms kbCtrl kbControl kbprb KB814743 kbAudDeveloper