Results 1 to 3 of 3

Thread: Problem in compiling DLL

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2000
    Location
    Wadala
    Posts
    1
    'My Class Module contains this properties

    Private WithEvents ocTextBox As TextBox

    Public Property Set TextBox(ByVal vData As TextBox)
    Set ocTextBox = vData
    End Property

    Public Property Get TextBox() As TextBox
    Set TextBox = ocTextBox
    End Property

    When i compile this(DLL) it is giving the following error:

    Private object modules cannot be used in public object modules as parameters or return types for public procedures as public data members,or as fields of public user defined types.

  2. #2
    Lively Member
    Join Date
    Jan 2000
    Posts
    102
    if i translate that error to simple words,
    it says you can't return TextBox (in property get),
    the way it is declared (private).

    maybe you can change it to public?
    maybe you can't really return TextBox data type?
    who knows.

  3. #3
    Member
    Join Date
    Jan 2001
    Location
    Washington, USA
    Posts
    61

    About using the text box example ...

    I had this exact same problem using VB6, when I tried to pass a ComboBox as a parameter into a subroutine that was in another DLL. Fortunately, I was working at Microsoft at the time, so I went down the hall to one of the people who developed the VB language.
    She said that it had something to do with threading. Since a ComboBox is a seperate OCX (a private object module), you will have difficulty in trying to pass it as a parameter.
    I was able to get around this by doing the following :

    'borrowing your code
    Private ocTextBox As Object

    Public Property Set TextBox(ByRef vData As Object)
    Set ocTextBox = vData
    End Property

    Public Property Get TextBox() As Object
    Set TextBox = ocTextBox
    End Property

    Using the data type Object, ocTextBox can't be dimensioned as WithEvents, and it will have to be initialized outside of the dll. But it did allow me to pass the object into another dll.

    Samwise Galenorn
    [email protected]

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