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;
- namespace karacsonyGUI
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- elkeszit_textBox1.Text = 0.ToString();
- eladott_textBox2.Text = 0.ToString();
- for (int i = 1; i < 41; i++)
- {
- comboBox1.Items.Add(i);
- }
- }
- private void hozzaad_button1_Click(object sender, EventArgs e)
- {
- bool hibas = true;
- hiba.ForeColor = Color.Red;
- if (Convert.ToInt32(elkeszit_textBox1.Text)<0|| Convert.ToInt32(eladott_textBox2.Text)<0)
- {
- hibas = false;
- hiba.Text = ("Negatív számot nem adhat meg!");
- }
- if (Convert.ToInt32(eladott_textBox2.Text)>Convert.ToInt32(elkeszit_textBox1.Text))
- {
- hibas = false;
- hiba.Text = ("Túl sok az eladott angyalka!");
- }
- if (hibas==true)
- {
- listBox1.Items.Add($"{comboBox1.Text}.nap\t+{elkeszit_textBox1.Text}\t- {eladott_textBox2.Text}\t=\t{Convert.ToInt32(elkeszit_textBox1.Text)-Convert.ToInt32(eladott_textBox2.Text)}");
- hiba.Text = "";
- }
- elkeszit_textBox1.Text = "0";
- eladott_textBox2.Text = "0";
- //for (int i = 1; i <= comboBox1; i++)
- //{
- // napok.Items.Remove(i);
- //}
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement