Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using System.IO;
- namespace zad_3
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- static FileStream fs;
- static StreamWriter sw;
- public delegate void Del(string str, string str2,decimal dec);
- public delegate void Del2();
- Del HandlerZapis = delegate (string imie, string nazwisko, decimal rok)
- {
- fs = new FileStream("D:\\!!!Studia\\Semestr 4\\Moje\\Informatyka\\Labki\\lab_7\\message3.txt", FileMode.Append, FileAccess.Write);
- sw = new StreamWriter(fs);
- sw.WriteLine(imie + " " + nazwisko + " " + " " + rok);
- sw.Flush();
- sw.Close();
- fs.Close();
- };
- Del2 HandlerOdczyt = delegate ()
- {
- StreamReader sr = new StreamReader("D:\\!!!Studia\\Semestr 4\\Moje\\Informatyka\\Labki\\lab_7\\message3.txt");
- String line = sr.ReadToEnd();
- sr.Close();
- MessageBox.Show(line);
- };
- private void PrzyciskZapisz_Click(object sender, EventArgs e)
- {
- HandlerZapis(Imie.Text, Nazwisko.Text, Rok.Value);
- }
- private void PrzyciskOdczyt_Click_1(object sender, EventArgs e)
- {
- HandlerOdczyt();
- }
- }
- }
Add Comment
Please, Sign In to add comment