---
title: "HOW TO PASS VALUE FROM ONE FORM TO ANOTHER FORM"  
description: "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 fol"  
author: "Anonymous User"  
published: 2010-08-01  
updated: 2019-09-07  
canonical: https://www.mindstick.com/articles/73/how-to-pass-value-from-one-form-to-another-form  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# HOW TO PASS VALUE FROM ONE FORM TO ANOTHER FORM

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        {            get            {                return 5;            }            set            {                num = value;            }        }    public int num1        {            get            {                return 15;            }            set            {                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;

## Example

Here br is object of form2 (browse form).

```
frmBrowse br = new frmBrowse();private void btnBrowse_Click(object sender, EventArgs e)        {                       br.ShowDialog();            txtId.Text = br.num;            txtName.Text = br.num1;                        panel1.Enabled = true;                    }
```

![HOW TO PASS VALUE FROM ONE FORM TO ANOTHER FORM](https://www.mindstick.com/mindstickarticle/a79d91e1-fed0-4adf-b6d0-604506154cad/images/555b1fa9-22d2-4ff6-9218-ce1abd798f24.png)

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).

![HOW TO PASS VALUE FROM ONE FORM TO ANOTHER FORM](https://www.mindstick.com/mindstickarticle/a79d91e1-fed0-4adf-b6d0-604506154cad/images/ab169623-bb02-4025-8341-3b354a710822.png)

\

---

Original Source: https://www.mindstick.com/articles/73/how-to-pass-value-from-one-form-to-another-form

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
