PRB: Error 35603 "Invalid Key" with TreeView or ListView Control (204054)
The information in this article applies to:
- Microsoft Visual Basic Professional Edition for Windows 5.0
- Microsoft Visual Basic Professional Edition for Windows 6.0
- Microsoft Visual Basic Enterprise Edition for Windows 5.0
- Microsoft Visual Basic Enterprise Edition for Windows 6.0
- Microsoft Visual Basic Professional Edition, 32-bit, for Windows 4.0
- Microsoft Visual Basic Enterprise Edition, 32-bit, for Windows 4.0
This article was previously published under Q204054 SYMPTOMS
If you add a ListItem to a ListView control or a node to a TreeView control when the value being assigned to the key is numeric or is a string that evaluates to a number (such as "123"), the following error message is raised:
Run-time error '35603':
Invalid key
CAUSE
Keys are restricted to non-numeric values for compatibility with the Visual Basic for Applications (VBA) Collection Object. Although collections allow numeric keys, an error could occur if an item in a collection was accessed using exclamation (!) syntax with a numeric key.
RESOLUTION
Append a non-numeric character to numeric keys.
STATUS
This behavior is by design.
Modification Type: | Minor | Last Reviewed: | 7/16/2004 |
---|
Keywords: | kbCmnCtrls kbListView kbnofix kbprb kbTreeView KB204054 |
---|
|