To pass value from one form to another we have to add a property in the form from which we want to send data. To set property we have to write the following code. Let us say this is form2.
public int num
num = value;
public int num1
num1 = value;
The code above will return 5 when the property when it is called from form1. To call the property from form1 we have to write the collowing code in form1.
int n = form2.num;
Here br is object of form2 (browse form).
frmBrowse br = new frmBrowse();
private void btnBrowse_Click(object sender, EventArgs e)
txtId.Text = br.num;
txtName.Text = br.num1;
panel1.Enabled = true;
Here form2 in Browse form. When any cell is clicked in data grid of this form the record will be transferred from this form to Record form (i.e. Form1).
Don't want to miss updates? Please click the below button!
Copyright © 2010 - 2015 MindStick Software Pvt. Ltd. All Rights Reserved.