Sub CreateAndShow(Of T As {Form, New})() Dim frm As New T() frm.Show() End Sub Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click CreateAndShow(Of Form2)() End Sub
Sub CreateAndShow(formClassName As String) Dim formType As Type = Type.GetType(formClassName) Dim instance As Form = DirectCast(Activator.CreateInstance(formType), Form) instance.Show() End Sub Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click CreateAndShow("WindowsApp1.Form2") End Sub