Exemplo n.º 1
0
        private void btnAddStudentScores_Click(object sender, EventArgs e)
        {
            Form frmAddScore = new frmAddScore();

            frmAddScore.Text = "Add score";

            DialogResult result = frmAddScore.ShowDialog();

            if (result == DialogResult.OK)
            {
                int score = (int)frmAddScore.Tag;
                scoresList.Add(score);
                DisplayScores();
            }
        }
Exemplo n.º 2
0
        private void btnUpdateScoreSelected_Click(object sender, EventArgs e)
        {
            int selectedIndex = lstBoxScores.SelectedIndex;

            if (selectedIndex > -1)
            {
                Form updateForm = new frmAddScore
                {
                    Text = "Update score",
                    Tag  = lstBoxScores.SelectedItem
                };

                DialogResult result = updateForm.ShowDialog();
                if (result == DialogResult.OK)
                {
                    int score = (int)updateForm.Tag;
                    scoresList.RemoveAt(selectedIndex);
                    scoresList.Insert(selectedIndex, score);
                    DisplayScores();
                }
            }
        }