Posts Tagged ‘User Control’

Use Reflection to load User Control from “text” value

Following is an exmpale of using reflection in .net to load user control in current assembly based on some text value provided. “CATUI.CATUserControls.ucMetadataProfiles”  full identifier of the usercontrol Type theType = Assembly.GetExecutingAssembly().GetType(“CATUI.CATUserControls.ucMetadataProfiles”); if (theType != null) { Object newObj = Activator.CreateInstance(theType); splitContainerMain.Panel2.Controls.Add((UserControl)newObj); }

More »