PRB: Error 35603 "Invalid Key" with TreeView or ListView Control
Article ID: 204054
Article Last Modified on 7/16/2004
APPLIES TO
- Microsoft Visual Basic 5.0 Professional Edition
- Microsoft Visual Basic 6.0 Professional Edition
- Microsoft Visual Basic 5.0 Enterprise Edition
- Microsoft Visual Basic 6.0 Enterprise Edition
- Microsoft Visual Basic 4.0 Professional Edition
- Microsoft Visual Basic 4.0 32-Bit Enterprise Edition
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.
Additional query words: comctl32 mscomctl 35603
Keywords: kbnofix kblistview kbtreeview kbcmnctrls kbprb KB204054