59 lines
1.7 KiB
C#
59 lines
1.7 KiB
C#
|
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 WindowsFormsApp1
|
|||
|
{
|
|||
|
public partial class Form1 : Form
|
|||
|
{
|
|||
|
public Form1()
|
|||
|
{
|
|||
|
InitializeComponent();
|
|||
|
}
|
|||
|
|
|||
|
private void label1_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
private void button1_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
int selectedItemIndex = Convert.ToInt32(comboBox1.SelectedIndex);
|
|||
|
int selectedItem = Convert.ToInt32(comboBox1.SelectedItem);
|
|||
|
|
|||
|
int done = Convert.ToInt32(textBox1.Text);
|
|||
|
int sold = Convert.ToInt32(textBox2.Text);
|
|||
|
|
|||
|
if (done < 0 || sold < 0)
|
|||
|
{
|
|||
|
MessageBox.Show("Rossz számot adtál meg.");
|
|||
|
} else if (sold > done)
|
|||
|
{
|
|||
|
MessageBox.Show("Túl sok az eladott angyalka.");
|
|||
|
} else
|
|||
|
{
|
|||
|
for (int i = 0; i <= selectedItemIndex; i++)
|
|||
|
{
|
|||
|
if (i == selectedItemIndex)
|
|||
|
{
|
|||
|
listBox1.Items.Add($"{selectedItemIndex}.nap:\t+{done}\t-{sold}={done - sold}");
|
|||
|
comboBox1.Items.RemoveAt(0);
|
|||
|
textBox1.Text = "0";
|
|||
|
textBox2.Text = "0";
|
|||
|
} else
|
|||
|
{
|
|||
|
listBox1.Items.Add($"{Convert.ToInt32(comboBox1.Items[0])}.nap:\t+0\t-0=0");
|
|||
|
comboBox1.Items.RemoveAt(0);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|