spendergrass
asked on
How do I pass in variable and use it to open form in VB.NET application?
I have a VB.NET 2.0 WinForms application. I have a procedure called LoadForm that allows me to pass in the parent form, child form name, and form caption and it opens up the child form within an MDI Container.
Private Sub LoadForm(ByVal objParentForm As Object, ByVal strChildForm As String, ByVal strCaption As String)
Dim typChildForm As Type = Type.GetType(strChildForm)
Dim frmChildForm As Form = CType(Activator.CreateInst ance(typCh ildForm), Form)
frmChildForm.Text = strCaption
frmChildForm.MdiParent = CType(objParentForm, Form)
frmChildForm.WindowState = FormWindowState.Maximized
frmChildForm.Show()
End Sub
I would like to be able to pass in a primary key and open the form with the appropriate record. Does anyone have an idea how I can update my procedure to allow me to pass in a primary key value and then use it on the form_load event to populate the form?
Thanks,
Sarah
Private Sub LoadForm(ByVal objParentForm As Object, ByVal strChildForm As String, ByVal strCaption As String)
Dim typChildForm As Type = Type.GetType(strChildForm)
Dim frmChildForm As Form = CType(Activator.CreateInst
frmChildForm.Text = strCaption
frmChildForm.MdiParent = CType(objParentForm, Form)
frmChildForm.WindowState = FormWindowState.Maximized
frmChildForm.Show()
End Sub
I would like to be able to pass in a primary key and open the form with the appropriate record. Does anyone have an idea how I can update my procedure to allow me to pass in a primary key value and then use it on the form_load event to populate the form?
Thanks,
Sarah
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
It's working! Thanks for your help!
ASKER