Results 1 to 6 of 6

Thread: ListView Control

  1. #1

    Thread Starter
    Hyperactive Member razzaj's Avatar
    Join Date
    Oct 1999
    Location
    jounieh
    Posts
    261

    Post

    i am using this code in my program qand it keeps giving me the following error :
    " Key is not unique in collection "
    i know it is unique all of my keys are i checked them over and over ....

    ListView1.ListItems.Add , "d", depname
    ListView1.ListItems.Add , "n", coursename
    ListView1.ListItems.Add , "c", credits
    ListView1.ListItems.Add , "t", coursedes


    ------------------
    - regards -
    - razzaj -

  2. #2
    Hyperactive Member
    Join Date
    Jun 1999
    Posts
    308

    Post

    Hi, razzaj.

    Try this code:

    Dim clmX As ColumnHeader
    Dim itmX As ListItem
    Dim i As Integer

    For i = 1 To 4
    Set clmX = ListView1.ColumnHeaders.Add()
    clmX.Text = "Col" & i
    Next i

    Set itmX = ListView1.ListItems.Add(, "d", "depname")
    Set itmX = ListView1.ListItems.Add(, "n", "coursename")
    Set itmX = ListView1.ListItems.Add(, "c", "credits")
    Set itmX = ListView1.ListItems.Add(, "t", "coursedes")

    Larisa

  3. #3

    Thread Starter
    Hyperactive Member razzaj's Avatar
    Join Date
    Oct 1999
    Location
    jounieh
    Posts
    261

    Post

    i tried that before , same error ... i dont understand ...

  4. #4
    Hyperactive Member
    Join Date
    Jun 1999
    Posts
    308

    Post

    This code doesn't give me any error messages. Sorry, I have no idea what can be wrong. I got this error once when I've tried to fill listview with records from db, but I've solved it. But if you are using the same code, then I don't know. Sorry couldn't help you.

    Larisa

  5. #5
    Member
    Join Date
    Jan 1999
    Location
    Garden Grove, CA, Orange
    Posts
    55

    Post

    put ListView1.ListItems.Clear before adding ListItems.

    Joon

  6. #6

    Thread Starter
    Hyperactive Member razzaj's Avatar
    Join Date
    Oct 1999
    Location
    jounieh
    Posts
    261

    Post

    thanx guys but i found out how to do it , it turned out to be like in vc++ ( more or less) here :

    dim itmX as listitem
    Set itmX = ListView1.ListItems.add(, , depname)
    itmX.SubItems(1) = coursename
    itmX.SubItems(2) = credits
    itmX.SubItems(3) = coursedes



    ------------------
    - regards -
    - razzaj -

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