Public Sub New(ByVal oldC As Control)
Dim FQTN As String = oldC.GetType.FullName
Dim t As Type = Type.GetType(FQTN)
Dim newC As Object = Activator.CreateInstance(t)
End Sub
FQTN
返回正确的类型名称,但t
为Nothing
。例如,FQTN = System.Windows.Forms.Panel
。
答案 0 :(得分:1)
摆脱FQTN
。
这适用于您正在寻找
的面板示例Public Sub New(ByVal oldC As Control)
Dim t As Type = oldC.GetType()
Dim newC As Object = Activator.CreateInstance(t)
End Sub
的副本