Beispiel #1
0
        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];
                    }
                }
            }
        }
Beispiel #2
0
 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++;
         }
     }
 }
Beispiel #3
0
        private void button2_Click(object sender, EventArgs e)
        {
            AddNew a = new AddNew();

            a.Show();
        }