Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

Sharing events in Mdi Program and runtime loaded childs

$
0
0

Hello, I made an mdi program and I load dinamically some child form this way:
 
Assembly newDll = Assembly.LoadFile("Child_01.exe");
Type type = newDll.GetType("Child.Form1");
 
Object obj = Activator.CreateInstance(type);
Form child = (Form)Activator.CreateInstance(type);
 
child.MdiParent = this;
child.WindowState = FormWindowState.Maximized;
child.Show();
 

In the child forms I would like to send event (for example pushing a button etc)
to the Parent Form.
 
I tried using an interface but I still can't make the Parent Form to get the rising of the event.
 
here's the interface example:
 
namespace EventManager
{
public interface IEventInterface
{
event EventHandler<testargs style="color:#111111;font-family:'Segoe UI', Arial, sans-serif;font-size:14px;line-height:normal;"> TestChanged;
void RaiseEvent(String value);
}
 
public class TestChangeArgs : EventArgs
{
public TestChangeArgs(String value)
{
ChangeText = value;
}
 
public String ChangeText { get; private set; }
}
}</testargs>

<testargs style="color:#111111;font-family:'Segoe UI', Arial, sans-serif;font-size:14px;line-height:normal;"></testargs>

<testargs style="color:#111111;font-family:'Segoe UI', Arial, sans-serif;font-size:14px;line-height:normal;">Thanks in advance</testargs>


Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>