Пример #1
0
        //load form
        private void EditQuestionForm_Load(object sender, EventArgs e)
        {
            //values to textboxes
            this.setTitle();
            this.questionTextbox.Text = this.question;
            this.lessonTextbox.Text   = this.lesson;

            //diff level set
            if (this.diff.Equals("Εύκολη"))
            {
                this.diffRadioButton1.Select();
            }
            else if (this.diff.Equals("Μέτρια"))
            {
                this.diffRadioButton2.Select();
            }
            else
            {
                this.diffRadioButton3.Select();
            }

            //get units
            List <string> units = db.qUnits(user, lesson);

            foreach (String unit in units)
            {
                this.unitsComboBox.Items.Add(unit);

                if (unit.Equals(this.unit))
                {
                    this.unitsComboBox.SelectedIndex = this.unitsComboBox.Items.Count - 1;
                }
            }



            //load answers
            answers = db.qAnswers(question, unit, user, lesson);

            this.editQuestionsDataGridView.Rows.Clear();

            foreach (String answer in answers)
            {
                this.editQuestionsDataGridView.Rows.Add(answer);
            }

            //load rows
            rows = this.answers.Count;

            if (rows == 6)
            {
                this.editQuestionsDataGridView.AllowUserToAddRows = false;
            }
        }
Пример #2
0
        private void ShowQuestionForm_Load(object sender, EventArgs e)
        {
            this.MaximizeBox = false;                  //set maximized button disable

            this.questionTextbox.Text = this.question; //set question Textbox
            this.lessonLabel.Text     = this.lesson;   //set lessons


            this.unitLabel.Text = this.unit;        //set unit
            this.diffLabel.Text = this.diff;        //set diff level

            //get answers
            List <string> answers = new List <string>();

            answers = db.qAnswers(question, unit, user, lesson);
            //answers.Add("Πρώτη απάντηση");
            //answers.Add("Δεύτερη απάντηση");
            //answers.Add("Τρίτη απάντηση");

            //fill answers to datagridview
            int i = 0;

            try
            {
                foreach (String ans in answers)
                {
                    this.showAnswersDataGridView.Rows.Add();
                    this.showAnswersDataGridView.Rows[i].SetValues(ans);
                    i++;
                    this.showAnswersPanel.Height = this.showAnswersDataGridView.Rows[0].Height * this.showAnswersDataGridView.Rows.Count;   //set datagridview height
                }
            }
            catch
            {
                Console.Write("error on fill answers");
            }
        }