Dim strFormName As String = "frmMyForm"
Public Function TryGetFormByName(frmname As String) As Form Dim formType = Assembly.GetExecutingAssembly().GetTypes().Where(Function(a) a.BaseType = GetType(Form) AndAlso a.Name = frmname).FirstOrDefault() If formType Is Nothing Then Return Nothing End If Return DirectCast(Activator.CreateInstance(formType), Form) End Function
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)