Microsoft KB Archive/820650

= Error message when you upgrade a Visual Basic 6.0 project to Visual Basic .NET 2003: &quot;UserControlName.ToolboxBitmap was not upgraded&quot; =

Article ID: 820650

Article Last Modified on 2/3/2006

-

APPLIES TO


 * Microsoft Visual Basic .NET 2003 Standard Edition

-





SYMPTOMS
In Microsoft Visual Basic 6.0, if you upgrade an ActiveX Control project or a project that contains a user control file by using the Visual Basic Upgrade Wizard, and the ToolboxBitmap property is set for the user control file, then the Visual Basic Upgrade Wizard reports the following error:

UserControl property UserControlName.ToolboxBitmap was not upgraded.

Therefore, when you build your project in Microsoft Visual Basic .NET, you receive the default bitmap of the user control file that is in the toolbox instead of the ToolboxBitmap that you selected in the Visual Basic 6.0 project.



WORKAROUND
To work around this problem, add the ToolboxBitmapAttribute to the user control after you upgrade your Visual Basic 6.0 project. To do this, follow these steps:  In Solution Explorer, right-click  , point to Add, and then click Add Existing Item. Locate the .bmp file that is associated with the user control file, and then click Open. Rename the .bmp file to the user control name.

For example, if the user control name is UserControl1, rename the .bmp file UserControl1.bmp . In Solution Explorer, right-click the .bmp file, and then click Properties. In the Properties window, set the Build Action property to Embedded Resource. In Solution Explorer, right-click UserControl1.vb, and then click View Code.  Add the following ToolboxBitmap attribute to the UserControl1 class: <ToolboxBitmap(GetType(UserControl1), &quot;UserControl1.BMP&quot;)> _ Public Class UserControl1 ... End Class </li></ol>

<div class="status_section">

STATUS
This behavior is by design.

<div class="moreinformation_section">

Steps to Reproduce the Behavior

 * 1) Create an ActiveX Control project in Visual Basic 6.0.
 * 2) Right-click UserControl1, and then click Properties.
 * 3) In the Properties window, set the ToolboxBitmap property of UserControl1 to Bitmap (for example, C:\MyBitmapName.bmp).
 * 4) Verify that the user control file has a specified bitmap in the toolbox, and then click Save.
 * 5) Open Microsoft Visual Studio .NET (2003).
 * 6) On the File menu, point to Open, and then click Project.
 * 7) Locate the project that you saved in step 4, and then click the project.
 * 8) Follow the instructions in the Visual Basic Upgrade Wizard to upgrade your Visual Basic 6.0 ActiveX Control project to a Microsoft Visual Basic .NET project.
 * 9) In Solution Explorer, double-click the _UpgradeReport.htm file.
 * 10) Expand UserControl1.vb.

You receive the error that is mentioned in the &quot;Symptoms&quot; section of this article.
 * 1) On the Build menu, click Build Solution to create the control.
 * 2) In the toolbox, click Add/Remove Items.
 * 3) Click Browse, and then click the control that you created in step 11.
 * 4) In the toolbox, verify that you receive the default icon for the user control.

Keywords: kbupgrade kbprb kbcontrol kbvs2005swept kbvs2005doesnotapply KB820650

-

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

© Microsoft Corporation. All rights reserved.