Results 1 to 5 of 5

Thread: ListView - Object not supported

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2001
    Posts
    95

    ListView - Object not supported

    Can anyone explain why I am receiving this error, "Object doesn't support this property or method" when I attempt to retreive a ListView called from a function?


    My Code:

    Private Sub Form_Load()
    ListView1 = getlistview(ListView1)
    End Sub

    Function getlistview(mylistview As ListView) As ListView
    mylistview.ListItems.Add , , "Fred"
    mylistview.ListItems.Add , , "Sarah"
    mylistview.ListItems.Add , , "Paul"
    Set getlistview = mylistview
    End Function

    Thank You,

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    I'm not sure, that is wierd maybe its some kind of default property wierdness. Anyway this works:

    VB Code:
    1. Private Sub Form_Load()
    2. filllistview ListView1
    3. End Sub
    4.  
    5. Sub filllistview(ByRef mylistview As ListView)
    6.     mylistview.ListItems.Add , , "Fred"
    7.     mylistview.ListItems.Add , , "Sarah"
    8.     mylistview.ListItems.Add , , "Paul"
    9. End Sub

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Oct 2001
    Posts
    95
    Exactly! Discovered same solution. Thanks for your help.

  4. #4
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    You know what I think it is, you can't set a control to something after its loaded.

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Oct 2001
    Posts
    95
    Interesting. But I was able to substitute the ListView with a ListBox and it worked perfectly.

    I think ListView is a different animal completley and copying all the properties and data is just not supported.

    Again, thanks for your interest

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