Microsoft KB Archive/285642

= BUG: Using an Add-In to Change the Name of a UserControl May Cause an Access Violation =

Article ID: 285642

Article Last Modified on 10/15/2002

-

APPLIES TO


 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition

-



This article was previously published under Q285642



SYMPTOMS
If you use an add-in to change the name of a UserControl, an access violation (AV) occurs. The error message is similar to the following:

VB6.EXE - Application Error

The instruction at &quot;0x004075a9&quot; referenced memory at &quot;0x0000000c&quot;. The memory could not be &quot;read&quot;.

Modifying the name of Projects, Modules, and Forms with an add-in does not cause an Access Violation.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.



MORE INFORMATION
This appears to be an issue only when you load a project from a file and then try to change the name of a UserControl in that project. The error message does not occur if you create a new ActiveX Control Project and then change the name of the UserControl.

Steps to Reproduce Behavior
 Create a new Visual Basic add-in project.  Open the design window for the form frmAddin and replace the current code for the click event of the OKButton with the following: Dim oUserCtl As VBComponent Dim oProj As VBProject

VBInstance.VBProjects.AddFromFile VBInstance.ActiveVBProject.FileName, True Set oProj = VBInstance.VBProjects.Item(&quot;Project1&quot;) Set oUserCtl = oProj.VBComponents(&quot;Usercontrol1&quot;) ' the following line causes the Access Violation: oUserCtl.Name = &quot;CoolName&quot; Unload Me                    Compile the add-in DLL. Start a new ActiveX Control project in Visual Basic. On the File menu, choose Save Project, and then save the project files to a folder. If it is not already loaded, load the add-in by using Add-In Manager. The name of the add-in should be My Addin.</li> On the Add-Ins menu, select My Addin.</li> Click OK, and note that an access violation occurs.</li></ol>

Additional query words: addin User ctl ctrl

Keywords: kbbug kbctrlcreate kbctrl kbpending kbideproject KB285642

-

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

© Microsoft Corporation. All rights reserved.