private void selectBtn_Click(object sender, EventArgs e) { KeyValuePair <string, string> selectValue = (KeyValuePair <string, string>)courseTrainee.SelectedValue; Attendence atd = new Attendence(); bool trainee = atd.InitiateAttendence(selectValue.Value, selectValue.Key); resultView.DataSource = atd.SelectAttendence(); if (!trainee) { MessageBox.Show("No Trainee for this Course", "Trainee Information", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } resultPanel.Visible = true; }