Ejemplo n.º 1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            var addForm = new txtScore();

            addForm.Text = "Add Score";

            var button = addForm.ShowDialog();

            if (button == DialogResult.OK)
            {
                var score = (double)addForm.Tag;
                student.Scores.Add(score);
                DisplayScores();
            }
        }
Ejemplo n.º 2
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            var updateForm = new txtScore();

            updateForm.Text = "Update Score";
            updateForm.Tag  = lstStudentScores.SelectedItem;

            var button = updateForm.ShowDialog();

            if (button == DialogResult.OK)
            {
                var score = (double)updateForm.Tag;
                student.Scores.Insert(lstStudentScores.SelectedIndex, score);
                student.Scores.RemoveAt(lstStudentScores.SelectedIndex + 1);
                DisplayScores();
            }
        }