private void Remove_Click(object sender, EventArgs e) { var toremove = button1.Text; var index = list.IndexOf(toremove); if (index < 0) { MessageBox.Show("Error!"); index = -1; } if (index == 0 || index % 2 == 0) { list.RemoveRange(index, 2); if (list.Count == 0) { MessageBox.Show("No words to show. Please add new words."); button1.Text = "Start"; AddNew a = new AddNew(); a.Show(); } else { if (index >= list.Count - 1) { index = 0; button1.Text = list[index]; } else { button1.Text = list[index]; } } } else { list.RemoveRange(index - 1, 2); if (list.Count == 0) { MessageBox.Show("No words to show. Please add new words."); button1.Text = "Start"; AddNew a = new AddNew(); a.Show(); } else { if (index > list.Count) { button1.Text = list[0]; index = 1; } else { button1.Text = list[index - 1]; } } } }
private void button1_Click(object sender, EventArgs e) { if (list.Count == 0) { MessageBox.Show("No words to show. Please add new words."); AddNew a = new AddNew(); a.Show(); } else { if (index > list.Count - 1) { button1.Text = list[0]; index = 1; } else { button1.Text = list[index]; index++; } } }
private void button2_Click(object sender, EventArgs e) { AddNew a = new AddNew(); a.Show(); }