CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 1999
    Posts
    2

    'Form' object unknown as BuildIn Type in ActiveX

    I just wrote my first dll's an ocx's and I needed to pass the Form object as a parameter to a public routine inside the dll. It all works fine as Function but trying to compile it to an activeX dll rises the error message that a user defined type is not allowed in a public member module.
    Usually the word 'Form' turns blue after typing it as a hint that it is recognized as a BuildIn Type. Here it stays black, as well as other types like 'Control'.
    The Procedure Call in the Dll is:
    Public Sub LoadResStrings(ByVal frm As Form, ByVal sSEP As String, ByVal iLanguage As Integer)

    Thanks fo any help
    Pete




    Pete

  2. #2
    Join Date
    May 1999
    Location
    Omika, Japan
    Posts
    729

    Re: 'Form' object unknown as BuildIn Type in ActiveX

    You cant pass a form or any other control byval. It has to be byRef. Change it and try

    If you want to be a specific form, you can change it to byref frm as MyForm also


  3. #3
    Join Date
    Jul 1999
    Posts
    2

    Re: 'Form' object unknown as BuildIn Type in ActiveX

    Thank's Ravi
    I tried it but the error Msg is still the same.
    'Form' is treated like a user defined type.
    Pete

    Pete

  4. #4
    Join Date
    May 1999
    Posts
    3,332

    Re: 'Form' object unknown as BuildIn Type in ActiveX

    I just tested this.
    You can pass your form object "As Object"
    client code

    Dim x as new Project2.Class1
    x.testthis me



    Activex DLL code

    public Sub testthis(frm as Object)
    MsgBox frm.hWnd
    End Sub







  5. #5
    Join Date
    May 1999
    Location
    Omika, Japan
    Posts
    729

    Re: 'Form' object unknown as BuildIn Type in ActiveX

    You can define it as a Object. It takes. i just ran a test.

    It seems to accept both ByRef and Byval. But i will safely assume, that ByVal passinf of objects has no effect on data-integrity!. This aside..
    Make sure but you pass only Forms, though it can accept any object, when defined like this


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