namespace SimpleClassLibrary1 { public class Class1 { //method public bool showmessageX(string message) { MessageBox.Show(message); return true; } } }2. I then created a new solution and created your MyReflectionClass exactly as you showed in your blog. The only change is I called it bbReflection.
private void button1_Click(object sender, EventArgs e) { string assembly = "C:\\VSX2008\\MyProjects\\bbReflection\\SimpleClassLibrary1\\bin\\Release\\SimpleClassLibrary1.dll"; string classname = "class1"; MyReflectionClass oReflection = new MyReflectionClass(assembly, classname); string message = ""; object o = oReflection.InstantiateClass(ref message); if (o == null) MessageBox.Show(message); else { // go on with your processing } }Everything compiles ok (no errors) but when I click the button, a message box with nothing appears. On stepping through the code, it is because
object o = oReflection.InstantiateClass(ref message);
always returns null.// go on with your processing
I want to call the method in bbReflection.Class1 - showmessageX to display the message, but it never runs that code because o is always null.if (oAssembly != null) oClass = oAssembly.CreateInstance(this.m_ClassName);Also what would be the syntax for calling the showmessageX method passing it a message to display?