private void SearchButton_Click(object sender, EventArgs e) { QuestionClass qc = new QuestionClass(); List <StoredQuizzes> SearchedQuizzes = new List <StoredQuizzes>(); SearchedQuizzes = qc.LoadQuizzes(SearchBarTextBox.Text + "%"); //Loads the quizzes that start with the search criteria from the database QuizListBox.DataSource = SearchedQuizzes; //Sets the data source to be these searched quizzes QuizListBox.DisplayMember = "Name"; //The quiz name is displayed }
public ViewStoredQuizzes() { InitializeComponent(); QuestionClass qc = new QuestionClass(); Quizzes = qc.LoadQuizzes("%"); //Loads the quizzes from the database that contain any question text QuizListBox.DataSource = Quizzes; //Sets the source for the list box to be the loaded quizzes QuizListBox.DisplayMember = "Name"; //The displayed item from the stored quizzes to be the name of the quiz //Hides the quiz display info so that it only appears when the user clicks on an item QuizNameLabel.Hide(); InsertQuizNameLabel.Hide(); QuestionsLabel.Hide(); QuestionsListBox.Hide(); ExpandButton.Hide(); }