CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2000
    Location
    Maryland
    Posts
    181

    How to add a function to an activex component?


    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





  2. #2
    Join Date
    Apr 1999
    Location
    VA BEACH
    Posts
    467

    Re: How to add a function to an activex component?

    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

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

Featured