How to

iebidan

Contributor
Joined
Feb 6, 2003
Messages
484
Maybe this has been posted, but I can't find a post to solve the problem... here is my problem

How can I make a Form that gets called from a Module be an MDIChild????, the Me statement seems not to work here :D I just need to pass to the form who is the MDIParent, but can't find the correct way to do it

Regards
 
You'll need a reference to the MDIParent form inside the module. I'm not sure of your code, but maybe you could pass the instance of the MDI form to the function in your module?

Once you have it, just set the child form's MdiParent property to the instance of the MDI form.

-Ner
 
The code in the function of the module is pretty simple

Visual Basic:
Module mLoader

Friend Function LoadForm(ByVal _Key as String)
   Select Case _Key
      Case "CLIENTS"
         Dim FormClient as FClients = New FClients()
         'FormClient.MdiParent = ????????
         FormClient.Show()
   End Select

End Function

End Module

The problem is how do I pass who is the MDIParent, I thought that declaring an Variable containing the MDIParent solved the problem, but that's not true

Hope you can help me out with this, look pretty simple but can't find the correct way to do it
 
make you function look like this:
Visual Basic:
Friend Function LoadForm(ByVal _Key As String, ByVal mdiparentform as yourformclassname)
'pass in the instance of your mdi parent
  Select Case _Key
      Case "CLIENTS"
         Dim FormClient As FClients = New FClients()
         FormClient.MdiParent = mdiparentform 'use the passed instance as the parent
         FormClient.Show()
   End Select

End Function
 
Back
Top