using System using System Collections Generic using System ComponentMo

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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 button1_Click(object sender, EventArgs e)
{
listBox1.Items.Clear();
string text = textBox1.Text;
List<string> words = new List<string>();
string[] stak = text.Split(' ');
foreach (string s in stak)
{
words.Add(s);
}
for (int i = words.Count - 1; i >= 0; i--)
{
listBox1.Items.Add(words[i]);
}
string kol = listBox1.Items.Count.ToString();
label2.Text = ("&#1050;&#1086;&#1083;-&#1074;&#1083; &#1101;&#1083;&#1077;&#1084;&#1077;&#1085;&#1090;&#1086;&#1074; &#1089;&#1090;&#1077;&#1082;&#1072;: "+kol);
}
private void button2_Click(object sender, EventArgs e)
{
if (listBox1.SelectedIndex != -1)
listBox1.Items.RemoveAt(listBox1.SelectedIndex);
else
MessageBox.Show("&#1042;&#1099;&#1073;&#1077;&#1088;&#1080;&#1090;&#1077; &#1101;&#1083;&#1077;&#1084;&#1077;&#1085;&#1090;");
}
private void button3_Click(object sender, EventArgs e)
{
listBox1.Items.Clear();
}
}
}