Exemplo n.º 1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            btnCalculate_Click(sender, e);
            lessonForm lessonForm = new lessonForm();

            lessonForm.txtGrade.Text  = lblGrade.Text;
            lessonForm.txtLetter.Text = lblLetterGrade.Text;
            if (lessonForm.ShowDialog() == DialogResult.OK)
            {
                string name   = lessonForm.txtLessonName.Text.Trim();
                string letter = getLetterGrade(averageGrade);
                FileLesson.writeLesson(name, averageGrade, letter);
            }
        }
Exemplo n.º 2
0
        private void toolAddLesson_Click(object sender, EventArgs e)
        {
            lessonForm lessonForm = new lessonForm();

            lessonForm.txtGrade.Enabled  = true;
            lessonForm.txtGrade.TabStop  = true;
            lessonForm.txtGrade.ReadOnly = false;

            if (lessonForm.ShowDialog() == DialogResult.OK)
            {
                string name   = lessonForm.txtLessonName.Text.Trim();
                double grade  = double.Parse(lessonForm.txtGrade.Text.Trim());
                string letter = lessonForm.txtLetter.Text;
                FileLesson.writeLesson(name, grade, letter);
            }
            updateList();
        }