Torna al Thread
'nell'evento load della form:
dim i as long = 0
dim sFormNames() as string '<-riempi coi nomi delle form che vuoi visualizzare
Do While i < sFormNames.count
MainTab.TabPages.Add("TAB" & i)
MainTab.TabPages(i).Height = 999
MainTab.TabPages(i).Width = 1666
frmX = CreateForm(sFormNames(i))
frmX.TopLevel = False
frmX.Visible = True
frmX.Top = 0
frmX.Left = 0
MainTab.TabPages(i).Controls.Add(frmX)
MainTab.TabPages(i).AutoScroll = True
i += 1
Loop
'e poi ci sono (io li ho messi in un modulo) a parte
Imports System
Imports System.Windows.Forms
Imports System.Reflection
Public Function CreateObjectInstance(ByVal objectName As String) As Object ' Creates and returns an instance of any object in the assembly by its type name.
Dim obj As Object
Try
If objectName.LastIndexOf(".") = -1 Then 'Appends the root namespace if not specified.
objectName = [Assembly].GetEntryAssembly.GetName.Name & "." & objectName
End If
obj = [Assembly].GetEntryAssembly.CreateInstance(objectName)
Catch ex As Exception
obj = Nothing
End Try
Return obj
End Function
Public Function CreateForm(ByVal formName As String) As Form ' Return the instance of the form by specifying its name.
Return DirectCast(CreateObjectInstance(formName), Form)
End Function