Microsoft KB Archive/191201

= BUG: Cannot Edit User Defined Type in Watch Window =

Article ID: 191201

Article Last Modified on 5/13/2003

-

APPLIES TO


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

-



This article was previously published under Q191201



SYMPTOMS
When you try to use the Watch window to modify values for User Defined types, you cannot modify the values.



RESOLUTION
Although a you cannot modify a User Defined type using the Watch window, you can modify it by using either of the following options:


 * Immediate window
 * Locals window
 * Modify the variable through code during the execution of the application.



STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this bug and will post new information here in the Microsoft Knowledge Base as it becomes available.



Steps to Reproduce Behavior
The following steps have been divided into two parts: creating the test ActiveX DLL, and modifying the user defined type in a Standard EXE application.

Creating a Test ActiveX DLL
 Start Microsoft Visual Basic and create an ActiveX DLL project. Class1 is created by default.  Add the following code to Class1: Public Type MyTest x as Integer y as Variant End Type  From the Project menu, click Project1 Properties. On the General tab, enter MyServer in the Project Name box, and click OK. From the File menu, click Make MyServer.dll. From the File menu, click Save Project, if desired.</ol>

Using the Watch Window
<ol> From the File Menu, click Add Project, and then double-click on Standard EXE. Form1 is created by default.</li> From the Project menu, click References. In the Available References list, select MyServer and click OK.</li>  Add the following code to the Load event of Form1: Private Sub Form_Load Dim f as MyTest, v     f.y = f      v = f      Stop End Sub </li> Press F5 to run the application. Once the application enters debug mode, highlight the "v" in the line of code immediately above the Stop command.</li> From the Debug menu, click Add Watch, and then click OK.</li> In the Watch window, expand the expression "v".</li> Change the Value for "y" to 5. This change is allowed by the Watch window.</li> Attempt to modify the value of "v" to 5 in the Watch window. The change is not allowed.</li></ol>

NOTE: You can change the value of "v" in the Immediate window using the expression "v=5". However, once this change occurs, "v" is no longer of type MyTest.

<div class="references_section">