2013-11-12

Get type from string and new an instance

menuItem.Tag = "namespace.class, dllname";
Type windowType = Type.GetType((string)(menuItem.Tag));
Control window = (Control)Activator.CreateInstance(windowType);
window.Show();

沒有留言:

張貼留言