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 fasz
- {
- public partial class Form1 : Form
- {
- public int bekertosszeg, teljesosszeg = 0;
- public string bekertnev;
- public string path = Environment.CurrentDirectory + "\\mentes.txt";
- public Form1()
- {
- InitializeComponent();
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- radioButton1.Checked = true;
- if (!File.Exists(path))
- {
- File.CreateText("mentes.txt");
- }
- else
- {
- FileStream fajl = new FileStream("mentes.txt", FileMode.Open);
- StreamReader olvaso = new StreamReader(fajl);
- // olvaso.ReadLine().Split(';');
- olvaso.Close();
- fajl.Close();
- }
- }
- private void radioButton1_CheckedChanged(object sender, EventArgs e)
- {
- }
- private void button2_Click(object sender, EventArgs e)
- {
- FileStream fajl = new FileStream("mentes.txt", FileMode.Open);
- StreamWriter iro = new StreamWriter(fajl);
- foreach (var item in listBox1.Items)
- {
- iro.WriteLine(item.ToString());
- }
- iro.Close();
- fajl.Close();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- DateTime most = DateTime.Now;
- try
- {
- bekertnev = textBox1.Text;
- bekertosszeg = int.Parse(textBox2.Text);
- }
- catch (FormatException)
- {
- MessageBox.Show("Számot adj meg a kurva anyádat");
- }
- catch (OverflowException ofe)
- {
- MessageBox.Show(ofe.ToString());
- }
- if (radioButton1.Checked)
- {
- teljesosszeg += bekertosszeg;
- listBox1.Items.Add(bekertnev + " " + bekertosszeg + " " + most + " " + teljesosszeg);
- MessageBox.Show(teljesosszeg.ToString());
- }
- if (radioButton2.Checked)
- {
- teljesosszeg -= bekertosszeg;
- if (teljesosszeg < 0)
- {
- MessageBox.Show("anyáddal szórakozz üres a kassza");
- }
- else
- {
- listBox1.Items.Add(bekertnev + " " + bekertosszeg + " " + most + " " + teljesosszeg);
- MessageBox.Show(teljesosszeg.ToString());
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement