BUG: Can't Assign an Object to an ActiveX Tag PropertyLast reviewed: November 7, 1997Article ID: Q176392 |
The information in this article applies to:
SYMPTOMSWhen you attempt to set the Tag property of an object in the Comctl32.ocx ActiveX Control, you will receive run-time error 424:
"Object required"The following examples cause the error:
Set TabStrip1.Tabs(1).Tag = Text1 Set Toolbar1.Buttons(1).Tag = Text1 Set StatusBar1.Panels(1).Tag = Text1 Set TreeView1.Nodes(1).Tag = Text1 Set ListView1.ListItems(1).Tag = Text1 Set ImageList1.ListImages(1).Tag = Text1If you assign an object to one of these Tag properties without using the "Set" statement, the default property of the object is correctly assigned to the Tag property. For instance, the following examples result in the Text property of Text1 being assigned to the Tag properties:
TabStrip1.Tabs(1).Tag = Text1 Toolbar1.Buttons(1).Tag = Text1 StatusBar1.Panels(1).Tag = Text1 TreeView1.Nodes(1).Tag = Text1 ListView1.ListItems(1).Tag = Text1 ImageList1.ListImages(1).Tag = Text1If the object you are assigning to the Tag property with this method does not have a default property, you correctly get error 438 "Object doesn't support this property or method." The following examples would result in this error because forms do not have default properties:
TabStrip1.Tabs(1).Tag = Me Toolbar1.Buttons(1).Tag = Me StatusBar1.Panels(1).Tag = Me TreeView1.Nodes(1).Tag = Me ListView1.ListItems(1).Tag = Me ImageList1.ListImages(1).Tag = MeIf the object you are assigning to the Tag property with this method is un- initialized, Visual Basic incorrectly attempts to navigate to the default property, which causes a crash. The following examples will cause an "Application error" under NT 4.0, or a "This Program has preformed an illegal operation" error under Windows 95:
Dim t As TextBox TabStrip1.Tabs(1).Tag = t Toolbar1.Buttons(1).Tag = t StatusBar1.Panels(1).Tag = t TreeView1.Nodes(1).Tag = t ListView1.ListItems(1).Tag = t ImageList1.ListImages(1).Tag = tSimilarly, setting the Tag property to "Nothing" causes the same crash.
STATUSMicrosoft 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.
MORE INFORMATIONThe online Help for the ActiveX Tag Property says the following:
"The Tag property is of type Variant for ActiveX control collections such as Toolbar Button objects, TreeView Node objects, ListView ListItem and ColumnHeader objects, ImageList ListImage objects, TabStrip Tab objects, and StatusBar Panel objects. This is a powerful language feature that enables you to pass, for example, objects (such as a selected Node) as a Tag."However, if you try to Set a Tag Property to an Object you will receive a run-time error 424 "Object required." You can, however, assign an object to a Tag Property and it will store the default property of the object to the Tag. You cannot store the Object itself in the Tag Property.
Steps to Reproduce Behavior
Keywords : vb5all kbbuglist Version : WINDOWS:5.0 Platform : WINDOWS Issue type : kbbug |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |