Microsoft KB Archive/258207

= BUG: Error Message "Object Does Not Support This Property ..." in Locals and Watch Window in Visual Basic 6.0 =

Article ID: 258207

Article Last Modified on 5/12/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 Q258207



SYMPTOMS
A multiuse class in an ActiveX DLL implements a public non-creatable class that has two properties. The class is instantiated in a Standard EXE, and values are assigned to the properties of the object just created. When the value of the form level object variable is examined in the locals window or a watch is set on it, Visual Basic 6.0 displays the following error message:



In Visual Basic 5.0, the values assigned to the properties are visible.



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



Steps to Reproduce Behavior
 Start a new Visual Basic Standard EXE project. Form1 is created by default. On the File menu, choose Add Project to add a new Visual Basic ActiveX DLL project, creating a Project Group. Class1 is created by default. Set the Instancing property of Class1 to 2-PublicNotCreatable.  Add the following code to the General Declarations section of Class1: Option Explicit

Public Property Get X As Long

End Property

Public Property Let X(ByVal X As Long)

End Property

Public Property Get Y As Long

End Property

Public Property Let Y(ByVal Y As Long)

End Property  On the Project menu, choose Add Class Module to add another class module to the project. Class2 is created by default. The Instancing property of Class2 is set to the default: 5-MultiUse.  Add the following code to the General Declarations section of Class2: Implements Class1 Private m_X As Long Private m_Y As Long

Private Property Get Class1_X As Long Class1_X = m_X End Property

Private Property Let Class1_X(ByVal X As Long) m_X = X End Property

Private Property Get Class1_Y As Long Class1_Y = m_Y End Property

Private Property Let Class1_Y(ByVal Y As Long) m_Y = Y End Property </li> Return to Project1 and add a CommandButton control to Form1.</li> On the Project menu, choose References to open the References dialog box. Check the reference to Project2 and click OK.</li>  Add the following code to the General Declarations section of Form1: Option Explicit

Private Sub Command1_Click Dim point As Class1 Set point = New Class2 point.X = 10 point.y = 20 Debug.Print point.X, point.y End Sub </li> Set a break point on the Debug.Print statement, run the project, and click Command1.</li> If the Locals window is not displayed, open the View menu and select the Locals window.</li> In the Locals window, click the plus sign (+) next to "point" to expand the tree view. Note that the following error message appears in the column where the values of x and y should be:

<Object does not support this property or method>

In Visual Basic 5.0, the values of x and y are set to 10 and 20, respectively.</li></ol>

Keywords: kbbug kbdebug kbpending KB258207

-

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

© Microsoft Corporation. All rights reserved.