Advertisement
Levi0227

karacsonyGUI-WinForm-2021maj

Apr 25th, 2023 (edited)
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.78 KB | Source Code | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10.  
  11. namespace karacsonyGUI
  12. {
  13.     public partial class Form1 : Form
  14.     {
  15.         public Form1()
  16.         {
  17.             InitializeComponent();
  18.         }
  19.  
  20.         private void Form1_Load(object sender, EventArgs e)
  21.         {
  22.             elkeszit_textBox1.Text = 0.ToString();
  23.             eladott_textBox2.Text = 0.ToString();
  24.             for (int i = 1; i < 41; i++)
  25.             {
  26.                 comboBox1.Items.Add(i);
  27.             }
  28.         }
  29.  
  30.         private void hozzaad_button1_Click(object sender, EventArgs e)
  31.         {
  32.             bool hibas = true;
  33.             hiba.ForeColor = Color.Red;
  34.             if (Convert.ToInt32(elkeszit_textBox1.Text)<0|| Convert.ToInt32(eladott_textBox2.Text)<0)
  35.             {
  36.                 hibas = false;
  37.                 hiba.Text = ("Negatív számot nem adhat meg!");
  38.             }
  39.             if (Convert.ToInt32(eladott_textBox2.Text)>Convert.ToInt32(elkeszit_textBox1.Text))
  40.             {
  41.                 hibas = false;
  42.                 hiba.Text = ("Túl sok az eladott angyalka!");
  43.             }
  44.             if (hibas==true)
  45.             {
  46.                 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)}");
  47.                 hiba.Text = "";
  48.             }
  49.             elkeszit_textBox1.Text = "0";
  50.             eladott_textBox2.Text = "0";
  51.             //for (int i = 1; i <= comboBox1; i++)
  52.             //{
  53.             //    napok.Items.Remove(i);
  54.             //}
  55.         }
  56.     }
  57. }
  58.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement