small example you can use i think...
Public Class Start
Public Shared Sub main()
Dim s As New Start
s.DoIt()
' Application.Run(New Form1)
End Sub
Public Sub DoIt()
Dim showOne As Boolean = False
If (showOne) Then
ShowIt(GetType(FormOne))
Else
ShowIt(GetType(FormToe))
End If
End Sub
Public Sub ShowIt(ByVal formType As Type)
Dim newForm As Form = DirectCast(Activator.CreateInstance(formType),
Form)
newForm.ShowDialog()
End Sub
End Class
Public Class FormOne
Inherits Form
Public Sub New()
Me.BackColor = Color.Red
End Sub
End Class
Public Class FormToe
Inherits Form
Public Sub New()
Me.BackColor = Color.Plum
End Sub
End Class
"Volker Jobst" <bu****@gmx.de> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi,
I have several forms in my application which are all inherited from
System.Windows.Forms.Form. Now I want to write one(!) function which gets
three parameters:
Sub OpenForm(frm as Class, userid As Integer, permission As Integer)
If CheckPermission(userid , permission) Then
Dim temp As frm = New frm
frm.ShowDialog()
Else
MsgBox("Access denied!!")
End if
End Sub
Call:
OpenForm(FormClass, 10, 20)
But I don't know how to pass the class into the sub. I tried Type,
Control, Class, Object and Form but nothing worked.
Thanks a lot.
volker jobst