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 Popis
- {
- public partial class Form1 : Form
- {
- List<string> popis = new List<string>();
- public Form1()
- {
- InitializeComponent();
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- button2.Enabled = false;
- }
- private void button2_Click(object sender, EventArgs e)
- {
- popis.RemoveAt(listBox1.SelectedIndex);
- listBox1.Items.Clear();
- foreach (string i in popis)
- {
- listBox1.Items.Add(i);
- }
- if (listBox1.Items.Count == 0)
- {
- button2.Enabled = false;
- }
- }
- private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
- {
- }
- private void button1_Click(object sender, EventArgs e)
- {
- bool empty = false;
- if (textBox1.Text == "")
- {
- MessageBox.Show("Niste unijeli artikl.", "Pogreška!");
- empty = true;
- }
- else
- empty = false;
- if (!empty)
- {
- popis.Add(textBox1.Text);
- listBox1.Items.Add(textBox1.Text);
- button2.Enabled = true;
- textBox1.Text = "";
- }
- }
- private void button3_Click(object sender, EventArgs e)
- {
- popis.Sort();
- listBox1.Items.Clear();
- foreach (string i in popis)
- {
- listBox1.Items.Add(i);
- }
- }
- private void button4_Click(object sender, EventArgs e)
- {
- Application.Exit();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement