myForm.MdiParent = Me
myForm.Show()
End Sub
I need something like (I know this doesn't work):
Private Sub OpenForm(ByRef myForm As Form)
myForm = New myForm.GetType()
myForm.MdiParent = Me
myForm.Show()
End Sub
I just posted what I am actually using for an answer to someones question at
http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=141602&SiteID=1&mode=1
I'm just trying to take it a step further... Thanks

Use generic form parameter to open specific form & create new instance.
Maheshkumar.R
Hello Zac,
i think you mean something like this.
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Dim frmForm4 As Form4
' Passing a Form Variable.
OpenForm(Of Form4)(frmForm4)
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button5.Click
' Without passing a Form Variable.
OpenForm1(Of Form5)()
End Sub
Private Sub OpenForm(Of FormTypePar As {Form, New})(ByRef myForm As
FormTypePar)
myForm = New FormTypePar
myForm.MdiParent = Me
myForm.Show()
End Sub
Private Sub OpenForm1(Of FormTypePar As {Form, New})()
Dim myForm As Form = New FormTypePar
myForm.MdiParent = Me
myForm.Show()
End Sub
LightDark2
BTW I didn't have to pass it the type. This worked, thanks again. If you have anymore cool tricks up your sleave pass em on.
Private Sub OpenGenericForm(Of FormType As {Form, New})(ByRef myForm As FormType)myForm = New FormType
myForm.MdiParent = Me
myForm.Show()
End Sub
OpenGenericForm(Company)
Paul Deckers
BTW,
I don't want to do some kind of Select Case for the myForm.GetType() or If CType(..,..)... blah..
That bypasses all the wonderful features that 2005 has given us :)
Thanks again
JocularJoe
You are the man!
I love this stuff