Advertisement
Smudla

Historie

May 9th, 2016
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.00 KB | None | 0 0
  1.   public partial class DialogHistorie : Form
  2.     {
  3.         ArrayList data = new ArrayList();
  4.         string fileName = "historie.txt";
  5.         public DialogHistorie()
  6.         {
  7.             InitializeComponent();
  8.             nactiTxtSoubor();
  9.         }
  10.  
  11.         private void nactiTxtSoubor()
  12.         {
  13.             string retezec;
  14.             data.Clear();
  15.             using (StreamReader sr = new StreamReader(File.OpenRead(fileName)))
  16.             {
  17.                 while (!sr.EndOfStream)
  18.                 {
  19.                     retezec = sr.ReadLine();
  20.                     data.Add(retezec);
  21.                 }
  22.             }
  23.             naplnTextBox();
  24.         }
  25.  
  26.         private void naplnTextBox()
  27.         {
  28.             textBox1.Text = "";
  29.             foreach (string retezec in data)
  30.             {
  31.                 textBox1.AppendText(retezec + "\n");
  32.             }
  33.         }
  34.  
  35.         private void button1_Click(object sender, EventArgs e)
  36.         {
  37.             Close();
  38.         }
  39.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement