private void StoreDataInFile(ShoalArea anArea) { try { fil.WriteLine(anArea.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; } }
private void FrmWaterDepth_Load(object sender, EventArgs e) { anArea = new ShoalArea(); try { fil = new StreamWriter("WaterData.txt"); //// To append data onto the end of the file, //// as opposed to creating a new file, //// add true as the 2nd argument //fil = new StreamWriter("WaterData.txt", true); } catch (DirectoryNotFoundException exc) { lblError.Text = "Invalid directory" + exc.Message; } catch (System.IO.IOException exc) { lblError.Text = exc.Message; } }
private void FrmWaterDepth_Load(object sender, EventArgs e) { anArea = new ShoalArea(); }