Results 1 to 3 of 3

Thread: Copying Objects

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2001
    Location
    South Africa
    Posts
    4

    Question

    I have a DLL which contains a Form (frmChild). I have a separate project (Standard EXE) which contains the MDI Form. I would like to load the frmChild into the MDI. Does anyone have any thoughts.

    This is what I have so far.

    DLL (ChildProj.Interface)
    DLL (frmChild)
    -------------------------------

    Public Sub LoadForm() as Object

    Set LoadForm = TransferObject(frmChild)

    End Sub

    Private Sub TransferObject(ByVal tForm as Form)

    Set TransferObject = tForm

    End Sub

    EXE (MdiProj)
    -----------------

    Private Sub MDILoad()

    Dim Obj as New ChildProj.Interface
    Dim frmObj as Form

    Set frmObj = Obj.LoadForm

    frmObj.Caption = "I Hope This Works"

    frmObj.Show '-> This fails, it says that it cannot find
    '-> a MDI Form. This makes me think that
    '-> the Form Object was passed by REF.

    End Sub

  2. #2
    Junior Member
    Join Date
    Feb 2001
    Location
    UK
    Posts
    16
    Try this


    Set frmObj = NEW Obj.LoadForm

    Without the NEW syntax you are probably changing the context of the Original MDI Form.

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2001
    Location
    South Africa
    Posts
    4
    Thanks.

    I tried it but that did not work either.

    I think the problem is that I am returning a Object.

    Object does not contain the form(frmChild) but rather a reference to that form.

    This is why when I try to load it, it tells me that it can not find a MDI form because it is loading in the DLL.

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