StrataFrame Forum

Pass a Value to a Child Form

http://forum.strataframe.net/Topic29428.aspx

By Terry Bottorff - 1/22/2011

I select a record in my parent table with a browse dialog. I then click an edit button to load a child form using a childformdialog.
That all works fine. I am trying to pass the name field from my contestantsbo to my child form just for information on my child form by putting the name in a label on my child form.
This is the code I am using on my parent form.

   Private Sub btneditdata_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btneditdata.Click
        'Me.ChildFormDialog1.ShowDialog()
        Dim frm As childform = New childform
        frm._cnames = Me._cname

        If Me.ChildFormDialog1.ShowDialog = System.Windows.Forms.DialogResult.OK Then
            SrswtdPointsBO1.Save()
        Else
            SrswtdPointsBO1.Undo(MicroFour.StrataFrame.Business.BusinessUndoType.AllRows)
        End If
    End Sub

    Private ReadOnly Property _cname() As String
        Get
            Return Me.ContestantsBO1.InvertedName
        End Get
    End Property

This is the code I am using on my child form.


    Friend WriteOnly Property _cnames() As String
        Set(ByVal value As String)
            Label6.Text = value
        End Set
    End Property

I put a break point on this line Label6.Text = value and 'value' has the exact info I want to display But it does not show up on the label on my form.

Please see attached picture of my child form.
By Teddy Jensen - 1/22/2011

Hi Terry,

You should use the childform constructor to pass over a value.

See this: http://forum.strataframe.net/Topic21120.aspx?Keywords=childform+constructor#bm21122

/Teddy
By Terry Bottorff - 1/22/2011

Thank you so much. Exactly what I was looking for. I searched for 'sending a parameter' and never got this hit.
Perfect. Thank you.
By Terry Bottorff - 1/22/2011

Yes Sir, right on. It worked like a charm.