Beispiel #1
0
        //  [Copy List Data] Menu Item
        private void copyListDataToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (formCopyListData == null)
            {
                formCopyListData           = new CopyListData();
                formCopyListData.MdiParent = this;
                // In the current context += means subscribe. In other words it's like you are telling subscribe my method (the right operand)
                // to this event (the left operand), this way, when the event is raised, your method will be called. Also, it is a good practice
                // to unsubscribe (-= from this event, when you have finished your work ( but before you dispose you object ) in order to prevent
                // your method being called and to prevent resource leaks.

                formCopyListData.FormClosed += formCopyListData_FormClosed;
                formCopyListData.Show();
            }

            else
            {
                // if the Form is already open
                formCopyListData.Activate();
            }
        }
Beispiel #2
0
 // [Copy List Data]
 private void formCopyListData_FormClosed(object sender, FormClosedEventArgs e)
 {
     formCopyListData = null;
 }