Link to home
Start Free TrialLog in
Avatar of RichardKline
RichardKline

asked on

Passing startup parameters to child from MDI parent

First time using Multiple Document Interface Windows forms.    

How does one pass startup parameters from the parent?  
Including a URL with examples would be gratefully accepted.

Thank you.
SOLUTION
Avatar of ghayasurrehman
ghayasurrehman
Flag of Pakistan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of RichardKline
RichardKline

ASKER

Going to be stupid about this. Converting this to vb.net, I have the SUBFORM code below which seems very reasonable.. But how do I code the parent?  

Thank you.

PARENT (does not work).
        Dim NewChild As subform = New subform("thisParameter")
        With NewChild
            .MdiParent = Me
            .Show()
        End With

SUBFORM
Public Class subform
    Private m_param1 As String

    Private Sub subform_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    End Sub

    Public Sub subform()
        InitializeComponent()
    End Sub

    Public Sub subform(ByVal param1 As String)
        Me.m_param1 = param1
        InitializeComponent()
    End Sub

End Class
what is the error?
have you set parent midcontainer property = true ?
or change the constructor as follows
Public Sub subform(ByVal param1 As String)
        InitializeComponent()
        Me.m_param1 = param1
End Sub

Open in new window

ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Sorry that I could not respond earlier.
ghayasurrehman, Error = VS 2010's Intellisense objected with an "unknown constructor" error.  But this parent code works fine with the subForm code as you presented it.
        Dim NewChild As subform = New subform()
        With NewChild
            .subform("ThisParameter")
            .MdiParent = Me
            .Show()
        End With
*************
jtoutou,
Very Cool.  I knew that you could directcast to/from a child form's element (label, textbox) but that was much too limiting.   Never thought about using Public Properties.  

Thank you, Both!