Advertisement
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 WindowsFormsApplication2
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void radioButton1_CheckedChanged(object sender, EventArgs e)
- {
- if (radioButton1.Checked == true)
- {
- string input = radioButton1.Text;
- File.AppendAllText("zapis.txt", input + Environment.NewLine);
- StreamWriter zapis = new StreamWriter("A");
- zapis.Close();
- }
- }
- private void radioButton2_CheckedChanged(object sender, EventArgs e)
- {
- if (radioButton2.Checked == true)
- {
- string input = radioButton2.Text;
- File.AppendAllText("zapis.txt", input + Environment.NewLine);
- StreamWriter zapis = new StreamWriter("B");
- zapis.Close();
- }
- }
- private void radioButton3_CheckedChanged(object sender, EventArgs e)
- {
- if (radioButton3.Checked == true)
- {
- string input = radioButton3.Text;
- File.AppendAllText("zapis.txt", input + Environment.NewLine);
- StreamWriter zapis = new StreamWriter("C");
- zapis.Close();
- }
- }
- private void button1_Click_1(object sender, EventArgs e)
- {
- string[] lines = File.ReadAllLines("zapis.txt");
- this.listBox1.Items.Clear();
- foreach (string line in lines)
- {
- this.listBox1.Items.Add(line);
- }
- }
- private void button2_Click(object sender, EventArgs e)
- {
- listBox1.Items.Clear();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement