gui event handling
-
I am having a hard time trying to implent winforms gui event handling. I have an mdi application where the the child form displayed depends on what which linklabel or button the user clicks (there is more than one way in different parts of the app to reach the same form). I want to pass the name of the form to display. I am trying to separate the event handling from the form (is this good app architecture?). Here is what I have so far, I know I am missing something, but I don't know what is :). Any help please? //define delegate public delegate void DisplayFormEventHandler(object sender, DisplayFormEventArgs e); //create custom event public class DisplayFormEventArgs : EventArgs { //Define and initialize two variables) } //handler to be executed when event fired public class DisplayFormHandler { public void windowToDisplay(object sender, DisplayFormEventArgs e) { switch(componenetClicked) case "Orders": //code here case "Settings": } } //event sender public class Home : System.Windows.Forms.Form { private void InitializeComponent() { LinkLabel newOrdersLink = new LinkLabel(); newOrdersLink.Click += new DisplayFormEventHandler(); } }