FormDataRielter.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. using System.IO;
  11. namespace СУБД_Агентство
  12. {
  13. public partial class FormDataRielter : Form
  14. {
  15. public FormDataRielter()
  16. {
  17. InitializeComponent();
  18. }
  19. private void FormDataRielter_Load(object sender, EventArgs e)
  20. {
  21. try
  22. {
  23. // открыть файл для чтения
  24. StreamReader sr = new StreamReader("data.txt");
  25. // прочитать данные из файла
  26. tbxMaxKlient.Text = sr.ReadLine();
  27. tbxProcPredl.Text = sr.ReadLine();
  28. tbxProcPotreb.Text = sr.ReadLine();
  29. sr.Close(); // закрыть файл
  30. }
  31. catch { }
  32. }
  33. private void btnSave_Click(object sender, EventArgs e)
  34. {
  35. try
  36. {
  37. // открыть файл для записи
  38. StreamWriter sw = new StreamWriter("data.txt");
  39. // сохранить данные в файл
  40. sw.WriteLine(tbxMaxKlient.Text);
  41. sw.WriteLine(tbxProcPredl.Text);
  42. sw.WriteLine(tbxProcPotreb.Text);
  43. sw.Close(); // закрыть файл
  44. }
  45. catch { }
  46. }
  47. }
  48. }