protected override void OnFormClosing(FormClosingEventArgs e)
        {
            DialogResult dialog = MessageBox.Show("Do you want to save it?", "Save?", MessageBoxButtons.YesNoCancel);

            if (dialog == DialogResult.Yes)
            {
                if (saved)
                {
                    Network.SaveToFile(myNetwork, FILE_PATH);
                    base.OnFormClosing(e);
                }
                else
                {
                    btnSaveAs.PerformClick();
                }
            }
            else if (dialog == DialogResult.No)
            {
                base.OnFormClosing(e);
            }
            else
            {
                e.Cancel = true;
            }
        }
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (FILE_PATH == "")
     {
         btnSaveAs.PerformClick();
     }
     else
     {
         Network.SaveToFile(myNetwork, FILE_PATH);
         saved        = true;
         lblInfo.Text = "Your file has been saved! " + DateTime.Now;
     }
 }
        private void btnSaveAs_Click(object sender, EventArgs e)
        {
            SaveFileDialog myDialog = new SaveFileDialog();

            myDialog.Title      = "Save netowork";
            myDialog.DefaultExt = ".XML";
            if (myDialog.ShowDialog() == DialogResult.OK & myDialog.FileName != null)
            {
                Network.SaveToFile(myNetwork, myDialog.FileName);
                FILE_PATH = myDialog.FileName;
                saved     = true;
            }
        }