PDA

Click to See Complete Forum and Search --> : Copying Objects


agfred
Feb 12th, 2001, 05:24 AM
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

uk-Canuck
Feb 12th, 2001, 07:02 AM
Try this


Set frmObj = NEW Obj.LoadForm

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

agfred
Feb 13th, 2001, 12:30 AM
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.