StrataFrame Forum

Passing in Params into ChildFormDialog control

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

By Leonard P. - 12/10/2008

Hello,

I have a form with a ChildFormDialog control on it, ChildFormDialog is mapped to another form and BO Translation setup. Everything works great, but I need to be able to pass in some params into the Child Dialog form.

I see that one of the overload methods of .ShowDialog(); takes in a params array. But I can't figure out how to catch them in the Child Form.

Can someone advise here.

Thanks.
By Guillermo Vilas - 12/10/2008

Hello Leonard,

If you send the parameter .ShowDialog("Hello World")

You can catch the parameter in the constructor of your ChildForm like this:







Dim m_sParam As String



Public Sub New (MyParam As String)

m_sParam = MyParam

End Sub







And do what ever logic you need.

If you are using SF ListView automation this won´t work since there´s no way to send parameters to childform from it.



Regards

Guillermo
By Michael Reese - 12/10/2008

Hey Leonard

In your main form when you call the child form set up a parameter to pass.

Private Sub AddRecordCode()

Dim LocSiteID As Integer

LocSiteID = Whatever

Call BO.Edit

 If Me.Childform.ShowDialog(LocSiteID) = Windows.Forms.DialogResult.OK Then
                '-- Refresh the Grid
Else

End Sub

-----------------------------------------------------------
Your Childform can get the parameter 


Pass the parameter through the form

Public Sub New(ByVal LocSiteID As Integer)

Your Param = LocSiteID

End Class

By Trent L. Taylor - 12/11/2008

All good suggestions.  It is just a matter of defining the parameters on your child form just as though you would be calling it directly.  Once this has been done, just provide all of the parameters in the ChildForm.ShowDialog in the order in which the constructor is expecting them.  That is basically it.  Let me know if you don't make any progress.
By Leonard P. - 12/11/2008

Yeah it worked. Thanks everyone.