private void addButton_Click(object sender, EventArgs e) { if (int.TryParse(addTextBox.Text, out int value)) { var item = new SortedItem(value, items.Count); items.Add(item); } RefreshItems(); addTextBox.Text = ""; }
private void fillButton_Click(object sender, EventArgs e) { var rnd = new Random(); if (int.TryParse(fillTextBox.Text, out int value)) { for (int i = 0; i < value; i++) { var item = new SortedItem(rnd.Next(100), items.Count); items.Add(item); } } RefreshItems(); fillTextBox.Text = ""; }