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; } }
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; } }