Results 1 to 4 of 4

Thread: Listview Question - What is the key parameter? Error not unique key given

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Oct 2000
    Posts
    1,463

    Question Listview Question - What is the key parameter? Error not unique key given

    I have a listbox and allow certain files to be dropped on and addedd with other info in columns. When I add two of the same files, I get an error saying the key is not unique in the collection. What is the key exactly? So I decided to change the key from the first example to the second below making the time the key if that would work and it does not. It says invalid key. I need to be able to add duplicate info to the listview control.

    Can someone help? I appreciate it!!!!


    Get error of not a unique key when duplicate data is added.
    Set lstItem = listview1.ListItems.Add(, text1.text, text1.text)


    This example errors as invalid key.
    Set lstItem = listview1.ListItems.Add(, Format(Time, "hhmmss"), text1.text)

  2. #2
    A Key is a unique string that identifies elements in the ListView, not in a ListBox.

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Oct 2000
    Posts
    1,463
    Why would I get an error on using the time as the key in the example I gave? What do you suggest to solve this and allow duplicate info to be added to the listview control?

    Thanks!

  4. #4
    BTW, here's the MSDN article on the Add method: http://msdn.microsoft.com/library/de...dlistitems.asp

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width