示例#1
0
 private void exportToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         if (saveFile.ShowDialog() == DialogResult.OK)
         {
             administration.Export(saveFile.FileName);
         }
     }
     catch (ArgumentNullException arnull)
     {
         MessageBox.Show(arnull.Message);
     }
     catch (ArgumentException argument)
     {
         MessageBox.Show(argument.Message);
     }
     catch (PathTooLongException pathlong)
     {
         MessageBox.Show(pathlong.Message);
     }
     catch (FileNotFoundException notfound)
     {
         MessageBox.Show(notfound.Message);
     }
     catch (ObjectDisposedException objectdis)
     {
         MessageBox.Show(objectdis.Message);
     }
 }
示例#2
0
        private void btnExport_Click(object sender, EventArgs e)
        {
            SaveFileDialog sfd = new SaveFileDialog();

            sfd.Filter = "Text file|*.txt|All files|*.*";
            if (sfd.ShowDialog() == DialogResult.OK)
            {
                administration.Export(sfd.FileName);
            }
        }
示例#3
0
 public AdministrationForm()
 {
     InitializeComponent();
     Administration = new Administration();
     Administration.Animals.Add(new Dog(1, new SimpleDate(21, 5, 1999), "Bello", new SimpleDate(18, 02, 2016)));
     Administration.Animals.Add(new Cat(2, new SimpleDate(3, 9, 2010), "Felix", "Grumpy"));
     Administration.Animals.Add(new Cat(3, new SimpleDate(17, 12, 1995), "Poekie", ""));
     Administration.Animals.Add(new Dog(5, new SimpleDate(6, 7, 2005), "Blaffie", new SimpleDate(29, 9, 2015)));
     RefreshFormInputFields(Refreshes.EnumReserveAnimal);
     Administration.Export(exportFile);
     RefreshForm = new Refreshes();
 }