void SearchbyName() { FrmSearchResult frm = new FrmSearchResult(); for (int i = 0; i < dgEmployees.Rows.Count; i++) { DataGridViewRow r = dgEmployees.Rows[i]; if (r.Cells[0].Value.ToString().Equals(txtSearch.Text)) { frm.AddEmployeeInfo(r.Cells[0].Value.ToString(), r.Cells[1].Value.ToString(), r.Cells[2].Value.ToString(), r.Cells[3].Value.ToString(), r.Cells[4].Value.ToString(), r.Cells[5].Value.ToString(), r.Cells[6].Value.ToString(), r.Cells[7].Value.ToString()); } } frm.ShowDialog(); }
private void BtnFilter_Click_1(object sender, EventArgs e) { FrmSearchResult frm = new FrmSearchResult(); for (int i = 0; i < dgEmployees.Rows.Count; i++) { DataGridViewRow r = dgEmployees.Rows[i]; if (r.Cells[3].Value.ToString().Equals(cbNationalFilter.Text)) //if (r.Cells[3].Value.ToString().Equals(cbNationalFilter.Text)) { frm.AddEmployeeInfo(r.Cells[0].Value.ToString(), r.Cells[1].Value.ToString(), r.Cells[2].Value.ToString(), r.Cells[3].Value.ToString(), r.Cells[4].Value.ToString(), r.Cells[5].Value.ToString(), r.Cells[6].Value.ToString(), r.Cells[7].Value.ToString()); } } frm.ShowDialog(); }