hi i want to duplicate existing form on runtime so it can be use multiple times. there is single way like
Sub loadForm()
Dim childForm As New myForm '<---
With childForm
.TopLevel = False
.StartPosition = FormStartPosition.CenterScreen
.Top = 199
.BringToFront()
Panel1.Controls.Add(childForm)
.Show()
End With
End Sub
but what i want that form should be duplicate with reference i tried
Sub LoadForm(ByVal childForm As Form)
'where childForm can be any myform1/mysale/mypurchase etc.
With childForm
.TopLevel = False
.StartPosition = FormStartPosition.CenterScreen
.Top = 199
.BringToFront()
Panel1.Controls.Add(childForm)
.Show()
End With
End Sub
where i call
LoadForm(myform1)
LoadForm(mysale)
this does not duplicate i also tried to create
Dim newChildForm as new childForm ' its give error 1 Type 'childForm' not defined