0
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 is returning the correct Type name, but t is Nothing. For instance, FQTN = System.Windows.Forms.Panel.

Tyler Montney
  • 1,402
  • 1
  • 17
  • 25

1 Answers1

1

Get rid of FQTN.

This works with the panel example you're looking for

Public Sub New(ByVal oldC As Control)
    Dim t As Type = oldC.GetType()
    Dim newC As Object = Activator.CreateInstance(t)
End Sub

Also, this is a duplicate of Type.GetType("namespace.a.b.ClassName") returns null

Community
  • 1
  • 1
Brandon
  • 4,491
  • 6
  • 38
  • 59