We help IT Professionals succeed at work.

User type not defined - listItem

Nothing99
Nothing99 asked
on
Hi!

I have a listview that use a listItem to populate.
ex.: Dim list As ListItem
     Set list = ListView1.ListItems.Add(, , "hi")
     list.SubItems(1) = "test"

It works well on my computer but when i try to use this code on another computer i have an error :"User type (listItem) not defined."

How can i add the "library" of listItem??

Thanks.
P.s.: Sorry for my bad english, i'm french.
Comment
Watch Question

Ryan ChongSoftware Tead Lead / Business Analyst / System Analyst / Data Engineer
CERTIFIED EXPERT

Commented:
Hi Nothing99,

Try to add the library in Module (Alt-F11) > Reference .

regards.
Hi,

1. You have to open the module in design mode.
2. Select tools->References
3. Choose Windows Controls Library Ver. 5.0 or 6.0 (depends on the listview version)
4. Yoy can now select Debug->Compile to assure that there is no error.

To do that at run time, you can:

Apllication.References.AddFromFile ....

Regards

Tarek