FIX: Cannot Edit Form or UserControl When You Host Another UserControl in Same Project (248285)
The information in this article applies to:
- Microsoft Visual Basic Enterprise Edition for Windows 5.0
- Microsoft Visual Basic Professional Edition for Windows 5.0
This article was previously published under Q248285 SYMPTOMS
If you try to edit the code for a form or UserControl that is hosting an instance of a UserControl (which is defined within the same project), the project cannot be edited. For example, if you modify a line of code, it reverts to its unmodified state when you move off the line.
If you continually try to edit the form or UserControl after the first try proves unsuccessful, you may receive one of the following error messages:
Compile error: invalid outside procedure
Error loading 'c:\temp\vb3c6.tmp'. A control could not be loaded due to load error. Continue?
The control instance may lose its control class; that is, the control instance is no longer an instance of a UserControl but an instance of a picture box.
CAUSE
When a UserControl is in the design environment and is hosted on a form or UserControl, the UserControl is running. If the UserControl is defined in the same project as the host, when you edit the host's code, the Visual Basic editor raises the error message when the edit invalidates the procedural layout of the code.
RESOLUTION
There are two ways to work around this problem in Visual Basic 5.0:
- Develop the control in a separate project than its host. This is the preferred workaround.
- Comment out the ReadProperties and WriteProperties events in the UserControl before you edit the host.
STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.
This bug was corrected in Visual Basic 6.0.
Modification Type: | Major | Last Reviewed: | 10/20/2003 |
---|
Keywords: | kbBug kbfix KB248285 |
---|
|