Exemple #1
0
        private void Add_Click(object sender, EventArgs e)
        {
            var add = new AddAndEdit();

            add.Text = "Add Student";
            if (add.ShowDialog() == DialogResult.OK)
            {
                StudentList.Items.Add(add.MyText);
            }
        }
Exemple #2
0
 private void Edit_Click(object sender, EventArgs e)
 {
     if (StudentList.SelectedIndex != -1)
     {
         var edit = new AddAndEdit();
         edit.Text   = "Edit Student";
         edit.MyText = StudentList.Items[StudentList.SelectedIndex].ToString();
         if (edit.ShowDialog() == DialogResult.OK)
         {
             StudentList.Items[StudentList.SelectedIndex] = edit.MyText;
         }
     }
 }