1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
private void button2_Click(object sender, System.EventArgs e)
{
this.openFileDialog1.ShowDialog();
string path = this.openFileDialog1.FileName;
Assembly a = Assembly.LoadFrom(path);
Type[] types = a.GetTypes();
this.listBox1.BeginUpdate();
foreach (Type CurrentType in types)
{
try
{
this.listBox1.Items.Add(CurrentType.ToString());
Type MyType = a.GetType("ForMdll");
MyType MyForm = new MyType();
MyForm.Show();
}
catch
{
}
// try
// {
// Type MyType = CurrentType.GetType();
// MyType t ;
//
// //CurrentType.InvokeMember("ForMdll",BindingFlags.InvokeMethod | BindingFlags.Public | BindingFlags.Static,null,null, null);
// }
// catch
// {
// MessageBox.Show(" Problem ! ");
// }
}
this.listBox1.EndUpdate();
} |
Partager