private void attendance_btn(object sender, EventArgs e) { this.Hide(); TutorSearch alt = new TutorSearch(c, t); alt.ShowDialog(this); }
private void SerchB_Click(object sender, EventArgs e) { if (First_Name.Text.ToString().Length == 0 || LastName.Text.Length == 0) { MessageBox.Show("Message", "Invaild first name or last name", MessageBoxButtons.OK); } if (c.State == ConnectionState.Closed) { c.Open(); } SqlDataAdapter ad = new SqlDataAdapter("select userid,last_name,first_name from Users where first_name LIKE'" + First_Name.Text.ToString() + "' and last_name LIKE'" + LastName.Text.ToString() + "'", c); DataTable dt = new DataTable(); ad.Fill(dt); c.Close(); if (dt.Rows.Count == 0) { MessageBox.Show("Message", "Not have student", MessageBoxButtons.OK); TutorSearch f = (TutorSearch)Owner; this.Close(); f.Show(); } Students.DataSource = dt; }