A simple way to pass value to another form is that you can define a public property in "another form" and then assign it after calling "Show()".
// AnotherForm.cs
public TextBox TB
{
get { return textBoxinAnotherForm; }
set{ textBoxinAnotherForm = value; }
}
//Form1.cs
private void btnTransfer_Click(object sender, EventArgs e)
{
AnotherForm anotherForm = new AnotherForm();
anotherForm.Show();
anotherForm.TB.Text = dataGridView1.Rows[0].Cells[0].Value.ToString();
}
Hi
FrmEditBank frm = new FrmEditBank();
frm.txtBankId.Text = gvBankCard.GetFocusedRowCellValue("BankId").ToString();
frm.cmbBankName.Text = gvBankCard.GetFocusedRowCellValue("BankName").ToString();
frm.ShowDialog();
Best Regards.
Please click the Mark as answer button and vote as helpful if this reply solves your problem.