0
votes

I have created OCX in Vb6 which contains only Listview control(added from MSCOMCTL.ocx) and coded "drag and drop" functionality and currently I want to implement the OCX in another application but I'm not sure how to handle the event.

Listview has predefined Event/Method/Property, when I create my OCX the predified Lisview events are not loaded. example Listview1.Listitem

public sub Listviewocx()
eventvar1 = Data.Files.Count
For intCOunter = 1 To eventvar1
strpath = Data.Files(intCOunter)
msgbox strpath
next
end with
End sub

Thanks Thiru

1
The question is not very clear. Do you mean, that you have created a UserControl containing a ListView, you can use the UserControl in another project, but you can't access the properties of the ListView from the other component? - Phil Jollans

1 Answers

0
votes

When you create ActiveX controls, you don't automatically expose the events, methods and properties of the constituent controls (in your case, the "constituent control" is the ListView). If, for example, you want a user of your control to have access to your ListView's click event, you have to raise the event again in the click event handler. Like this:

Sub ListView1_Click() 
    RaiseEvent "MyListViewClick"
End Sub

Then, in your application that uses your control:

Sub Listviewocx_MyListViewClick()
    'Handle the event here
End Sub

You have to do similar things with properties and methods of your constituent controls.

For more information, read this and the related doc about ActiveX controls.