I have written the following in Form2
//Form2
public string getTerminalID
{
get {return txtTerminalID.Text;}
}
private void btnFind_Click_1(object sender, EventArgs e)
{
this.Close();
}
//Main Form
public void getTerminalID(string record)
{
foreach (DataGridViewRow Row in dtgIngenico.Rows)
{
if (Row.Cells["TerminalID"].Value.ToString() == record)
{
Row.Selected = true;
break;
}
}
}
private void btnFind_Click(object sender, EventArgs e)
{
frmFilter frmfil = new frmFilter();
frmfil.ShowDialog();
findrecord(frmfil.getTerminalID);
}