Microsoft KB Archive/814743

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

Article ID: 814743

Article Last Modified on 11/14/2007

-

APPLIES TO


 * Microsoft Visual Basic .NET 2003 Standard Edition
 * 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.



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.
 * 1) On the toolbox, add a TextBox to UserControl1, and then close UserControl1.

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

Visual Basic Update Wizard is displayed.
 * 1) 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.
 * 2) In Solution Explorer, double-click Form1.vb to open Form1.

The behavior mentioned in the &quot;Symptoms&quot; section of this article occurs.

