ListView 6.0 control properties missing?

vman21

Registered User.
Local time
Yesterday, 23:34
Joined
Feb 25, 2014
Messages
18
Greetings.

I am following this tutorial below for the listview 6.0 control in VBA but I don't seem to have this properties .. such as:
Code:
With Me.ListView1.ColumnHeaders
With Me.ListView1.GridLines = True
.ListItems.Clear

tek - tips.com/faqs.cfm?fid=6025


Any idea why I don't have those ?
 
Are you confusing the Access.Listbox class with the MSComCtlLib.Listview class? Check your object browser, do you see a reference to MSComCtlLib?
 
I added the Microsoft ListView 6.0 control via the activeX controls option. In the object browser, I can see Class: MSComctlLib.ListViewCtrl.2 and OLE Class: ListViewCtrl. I am using microsoft office professional plus 2010 if this makes a differences?
 
Oh, OK. So, the actual Listview object lives inside a CustomControl control on the form, and when you use the Me.Listview1 construct you are actually only referring to the control that hosts the listview, not the listview itself.

What I commonly do to get intellisense on the object itself, declare a variable of that type, and then assign it the Object property of the host control. Blah, blah, but the code is clearer . . .
Code:
Private m_list as MSComCtlLib.ListView

Private Sub Form_Open(Cancel As Integer)
   [COLOR="Green"]'assign the object in the control to the strongly typed variable[/COLOR]
   Set m_list = Me.Listview1.Object 
End Sub
So that's dead simple and you get intellisense on m_list.
 

Users who are viewing this thread

Back
Top Bottom