BUG: Error Message 438 with the For Each Statement in TreeView Control (254798)
The information in this article applies to:
- Microsoft eMbedded Visual Basic 3.0
This article was previously published under Q254798 SYMPTOMS
When you use the For Each statement to go through each node in the Nodes collection of the TreeView control, you encounter the following run-time error message:
438 Object doesn't support this property or method.
RESOLUTION
You can work around the problem by using the Nodes.Count property to obtain the number of Nodes in the Treeview, and then loop through the nodes in the collection by using the index of the node.
In the example shown in the "Steps to Reproduce Behavior" section you can fix the problem by replacing the code in the Command2_Click event procedure with the following code:
Private Sub Command2_Click()
Dim n As Integer
On Error Resume Next
For n = 1 To TreeViewCtl1.Nodes.Count
If Err.Number <> 0 Then
MsgBox Err.Number & vbCr & Err.Description
End If
If TreeViewCtl1.Nodes(n).Expanded Then
TreeViewCtl1.Nodes(n).Expanded = False
End If
Next
End Sub
STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.
Modification Type: | Major | Last Reviewed: | 10/15/2002 |
---|
Keywords: | kbBug kbDSupport kbToolkit KB254798 |
---|
|