PDA

Click to See Complete Forum and Search --> : Listview Key


bontyboy
Mar 12th, 2000, 05:31 PM
I am trying to attach a key to my items I'm adding in the listview control and I get the error "Invalid key".
The key I am adding is a primary number "13" which I use as a string. I thought the key accepted a string. I also tried to make it a integer but that did not work either. I think its something to do with the key being unique. I can't figure it out.

VorTechS
Mar 13th, 2000, 03:55 PM
Your problem is not a 'unique' identity problem, otherwise the list would tell you so with the error 'Key is not unique in collection'.

The thing about Listviews and keys is that even though you may convert '13' into a string, it still recognises it as a number (we'll call it cleverness shall we?).

If you want to use a numeric as the key, the best thing to do is append a single letter before the number you want to use...ie make the key 'K13' instead of just '13'.

Hope this helps you!