示例#1
0
 private void frmWaterDepth_Load(object sender, EventArgs e)
 {
     anArea = new ShoalArea();
     try
     {
         fil = new StreamWriter("WaterData.txt");
     }
     catch (DirectoryNotFoundException exc)
     {
         lblError.Text = "Invalid directory" + exc.Message;
     }
     catch (System.IO.IOException exc)
     {
         lblError.Text = exc.Message;
     }
 }
示例#2
0
 private void StoreDataInFile(ShoalArea a2Area)
 {
     try
     {
         fil.WriteLine(a2Area.ShoalAreaRecord);
     }
     catch (DirectoryNotFoundException exc)
     {
         lblError.Text = "Invalid directory" + exc.Message;
     }
     catch (InvalidDataException exc)
     {
         lblError.Text = "Invalid format in data stream " + exc.Message;
     }
     catch (System.IO.IOException exc)
     {
         lblError.Text = exc.Message;
     }
 }