Click to See Complete Forum and Search --> : How to add a function to an activex component?


Wango
August 14th, 2001, 04:20 PM
I stole an activex component that I am tying to moodify
so that I can build an ocx component to be slammed into
my C++ code.

Function

private Sub UserControl_InitProperties()



was already there.

When I tried to add (Declarations area of the UserControl)


public Sub UserControl_Initialize(FileName as string, _
DirFullPath as string, TBD as string)



So that I can call it (UserControl_Initialize) in my C++
code and pass in info, I get a compile error

"Procedure declaration does not match description of event
or procedure having the same name"

What I am I doing wrong?


'Initialize Properties for User Control
private Sub UserControl_InitProperties()
set Font = Ambient.Font
End Sub


' added to be exposed in c++ code and pass in values
public Sub UserControl_Initialize(FileName as string, _
DirFullPath as string, TBD as string)
'public Sub UserControl_Initialize()

Dim sFile as string
Dim tFile as string

' MsgBox "Filepath='" & sFile & "'" & vbCr & "FileTitle='" & tFile & "'"

Call startWord(sFile, tFile)


End Sub

James Longstreet
August 15th, 2001, 09:09 AM
You cannot declare the initialize function as public. This is an event fired by the control to the container( your VB control is the container in this case ); which cannot be public.



Jim Hewitt
Software Developer
Liberty Tax Service
www.LibertyTax.com