private void ViewExamBtn_Click(object sender, EventArgs e) { ComboboxItem item = (ComboboxItem)examsCombobox.SelectedItem; int exam_id = Int32.Parse(item.Value.ToString()); examquestions = ExamQuestionDAL.GetExamQuestions(exam_id); for (int i = 0; i < examquestions.Count; i++) { string name = QuestionDAL.GetQuestionTypeName(examquestions[i].Question.Type); dataGridView1.Rows.Add(name, examquestions[i].Question.QuestionText); } }