BUG: TreeView Nodes Count Property Limited to 32767 (182231)
The information in this article applies to:
- Microsoft Visual Basic Learning Edition for Windows 5.0
- Microsoft Visual Basic Learning Edition for Windows 6.0
- Microsoft Visual Basic Professional Edition for Windows 5.0
- Microsoft Visual Basic Professional Edition for Windows 6.0
- Microsoft Visual Basic Professional Edition for Windows 4.0
- Microsoft Visual Basic Enterprise Edition for Windows 5.0
- Microsoft Visual Basic Enterprise Edition for Windows 6.0
- Microsoft Visual Basic Enterprise Edition for Windows 4.0
This article was previously published under Q182231 SYMPTOMS
The Count property of the Nodes collection for a TreeView control returns
an incorrect value if you add more than 32767 nodes to the TreeView. The
Index property of a Node object also returns an incorrect value for the
same reason. If you add more than 65535 nodes, the TreeView's scrollbar may
disappear and the TreeView may experience redraw problems.
NOTE: In Visual Basic 4.0, you may receive the following error if you
attempt to add more than 32767 nodes to a TreeView control:
Run-time error '7':
Out of memory
CAUSE
The Count property of the Nodes collection and the Index property of a Node
object are limited to Integer values. If you add an additional node beyond
32767 nodes, the Count property of the Nodes collection returns a value of
-32768 (instead of 32768). Adding another node to the TreeView results in
the Count property returning a value of -32767, and so on. After adding
65536 nodes, the Count property reverts back to a value of 0. When this
occurs, the TreeView control appears empty with no scrollbars because it
thinks there are no actual nodes to display.
RESOLUTION
It is not recommended that you add more than 32767 nodes to a TreeView
control. If you need more than 32767 nodes, you should consider using
multiple TreeView controls or a control more suited for larger amounts of
data.
If you would like to maintain more than 32767 nodes using Visual Basic
versions after version 4.0 in a TreeView control, you should keep the
following in mind:
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.
Modification Type: | Major | Last Reviewed: | 5/13/2003 |
---|
Keywords: | kbbug kbGrpDSVB kbpending KB182231 kbAudDeveloper |
---|
|