private void btnSearch_Click(object sender, EventArgs e) { try { DatabaseManager db = new DatabaseManager(); string[] array = db.FindCourse(searchBox.Text); txtID.Text = array[0]; txtName.Text = array[1]; TeacherBox.Text = array[2]; DepartmentBox.Text = array[3]; label14.Hide(); searchBox.Hide(); btnSearch.Hide(); label1.Show(); label2.Show(); label3.Show(); label4.Show(); txtID.Show(); txtName.Show(); TeacherBox.Show(); DepartmentBox.Show(); btnEdit.Show(); btnDelete.Show(); btnBack.Location = new Point(37, 252); DepartmentBox.Text = "Department Name"; } catch (Exception ee) { MessageBox.Show("Data Retrieve Error"); } }
private void btnSearch_Click(object sender, EventArgs e) { try { DatabaseManager dm = new DatabaseManager(); string[] student = dm.FindFaculty(searchBox.Text); txtID.Text = student[0]; txtName.Text = student[1]; txtPassword.Text = student[2]; if (student[3] == "Male") { radioMale.Checked = true; } else { radioFemale.Checked = true; } BGBox.Text = student[4]; datePicker.Value = Convert.ToDateTime(student[5]); DepartmentBox.Text = student[6]; txtContact.Text = student[7]; txtEmail.Text = student[8]; txtAddress.Text = student[9]; pictureBox.Image = Image.FromFile(student[10]); picURL = student[10]; label14.Hide(); searchBox.Hide(); btnSearch.Hide(); label1.Show(); label2.Show(); label3.Show(); label4.Show(); label5.Show(); label6.Show(); label7.Show(); label10.Show(); label12.Show(); label13.Show(); btnEdit.Show(); btnDelete.Show(); btnBack.Location = new Point(440, 319); txtID.Show(); txtName.Show(); txtPassword.Show(); txtAddress.Show(); txtContact.Show(); txtEmail.Show(); radioFemale.Show(); radioMale.Show(); BGBox.Show(); DepartmentBox.Show(); datePicker.Show(); pictureBox.Show(); } catch (Exception ee) { MessageBox.Show(ee.Message); } }