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.CreateInstance(typChildForm), Form)
frmChildForm.Text = strCaption
frmChildForm.MdiParent = CType(objParentForm, Form)
frmChildForm.WindowState = FormWindowState.Maximized
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?