Microsoft KB Archive/819029

= You receive an error message when you add an ActiveX Control to a Visual Basic 6.0 form =

Article ID: 819029

Article Last Modified on 12/19/2003

-

APPLIES TO


 * Microsoft Visual Basic 6.0 Enterprise Edition
 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic for Applications 6.0
 * Microsoft Visual Basic 6.0 Learning Edition

-



SYMPTOMS
When you add a Microsoft ActiveX control to a Microsoft Visual Basic 6.0 form, you may receive the following error message and then Visual Basic Editor may close unexpectedly:

Visual Basic has encountered a problem and needs to close. We are sorry for the inconvenience.



CAUSE
When you add an ActiveX control to a Visual Basic 6.0 form, Visual Basic cannot create the ActiveX control cache (.oca) file for the control. This problem occurs if the user who adds the control does not have Create/Write permissions to the following folders on the computer:
 * The Windows folder, typically C:\WINNT or C:\Windows
 * The OCX folder, typically C:\WINNT\System32
 * The Visual Basic Installation folder, typically C:\Program Files\Microsoft Visual Studio\VB98



RESOLUTION
To resolve this problem, give the user Create/Write permissions to the folders that are listed in the &quot;Cause&quot; section of this article. Visual Basic Editor can then create the .oca file.



WORKAROUND
To work around this problem, an administrator can create the .oca file. To do this, an administrator can log on to the computer, insert the ActiveX control, and then log off the computer. Subsequently, a non-administrative user can successfully add the ActiveX control to the Visual Basic 6.0 form.



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the &quot;Applies to&quot; section of this article.



Steps to reproduce the behavior

 * 1) Log on to the computer as an administrator.
 * 2) Revoke Create/Write permissions to the following folders for the non-administrative user:
 * C:\WINNT folder
 * C:\WINNT\System32
 * C:\Program Files\Microsoft Visual Studio\VB98
 * 1) Verify that there are no pre-existing .oca files in the folders that are listed in step 2. If there are pre-existing .oca files, rename the files or delete the files.
 * 2) Log off the computer as an administrator, and then log on to the computer as the non-administrative user from step 2.
 * 3) Start Visual Basic 6.0.
 * 4) On the Project menu, click Components.
 * 5) In the Components dialog box, click to select the Microsoft Common Dialog Control 6.0 control.
 * 6) Click OK to close the Components dialog box.

You receive the error message that is mentioned in the &quot;Symptoms&quot; section of this article.

