private void QuestionListBox_MouseDoubleClick(object sender, MouseEventArgs e) { //When the user selects a question the question information is displayed over the previous, this code completes that action AnswerHeaderLabel.Show(); QuestionHeaderLabel.Show(); if (QuestionListBox.SelectedItem == null) { } else { //Assigning the selected question to a variable StoredQuestions SelectedQuestion = (StoredQuestions)QuestionListBox.SelectedItem; if (SelectedQuestion.PictureUrl == "" || SelectedQuestion.PictureUrl == null) { QuestionPictureBox.Hide(); } else { QuestionPictureBox.Show(); QuestionPictureBox.Image = Image.FromFile(SelectedQuestion.PictureUrl); } QuestionLabel.Text = SelectedQuestion.Question; AnswerLabel.Text = SelectedQuestion.CorrectAns; } }
bool formclosing = false; //A boolean used to hold if the form is closing or not. public GenerateQuizManual() { InitializeComponent(); QuestionClass qc = new QuestionClass(); AllQuestions = qc.LoadAllQuestions(); //Loads the questions from the SQL database QuestionListBox.DataSource = AllQuestions; //Adds the questions to the question list box QuestionListBox.DisplayMember = "DisplayItem"; QuestionHeaderLabel.Hide(); AnswerHeaderLabel.Hide(); DifficultyCheckBox.Hide(); //Sets the question to hide the empty question details }
public ViewAllQuestionsForm() { InitializeComponent(); DifficultyCheckBox.Hide(); QuestionClass qc = new QuestionClass(); //All of the questions are loaded from the class and are used as a base to refer to AllQuestions = qc.LoadAllQuestions(); QuestionListBox.DataSource = AllQuestions; QuestionListBox.DisplayMember = "DisplayItem"; QuestionHeaderLabel.Hide(); AnswerHeaderLabel.Hide(); //Sets the question to hide the empty question details }