I have found this code in this forum:

Dim objForm As Form
Dim sValue As String
Dim FullTypeName As String
Dim FormInstanceType As Type

' Form class name
sValue = "Form2"

' Assume that form classes' namespace is the same as ProductName
FullTypeName = Application.ProductName & "." & sValue
' Now, get the actual type
FormInstanceType = Type.GetType(FullTypeName, True, True)
' Create an instance of this form type
objForm = CType(Activator.CreateInstance(FormInstanceType), Form)
' Show the form instance

but i need to show the form once even how many times a button is clicked. is this possible?

maybe you could use a boolean variable to know if the form is already open.. example you declare boolean formVisible, when a button is clicked you could check if formVisible is true, if true, do nothing if false open the form. now when you close the form you should set the formVisible to false.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.