• We just launched and are currently in beta. Join us as we build and grow the community.

How Pass the Data to Another Form in C#.Net

Mr.CommCicken

Pun Mastermind
M Rep
0
0
0
Rep
0
M Vouches
0
0
0
Vouches
0
Posts
59
Likes
89
Bits
2 MONTHS
2 2 MONTHS OF SERVICE
LEVEL 1 300 XP
In this tutorial, I will teach you how to pass the data to another form in c#. This method has the ability to pass the value of the TextBox in Form1 to a TextBox in Form2. This method is so simple yet powerful. I hope this tutorial will help you solve your current problem in passing data to another form in c#. See the procedure below.
Creating Application

Step 1

Open Microsoft Visual Studio 2015 and create a new windows form application in c#. After that, do the Form just like this.
2018-09-24_1.png

Step 2

Add another Form.
2018-09-24.png

Step 3

Do the Form2 just like shown below.
2018-09-24_3.png

Step 4

Double click the Form2 and do the following code for getting the data in the Form1.
  1. public

    Form2(

    string

    title,string

    by

    )
  2. {
  3. InitializeComponent(

    )

    ;
  4. textBox1.

    Text

    =

    title +

    " (:--------:) "

    +

    by

    ;

  5. }

Step 5

Go to the Form1 and double click the Button to fire the click even handler

of it. After that, do the following code in the method.
  1. string

    titile =

    textBox1.

    Text

    ;
  2. string

    by

    =

    textBox2.

    Text

    ;

  3. Form2 frm =

    new

    Form2(

    titile ,by

    )

    ;
  4. frm.

    Show

    (

    )

    ;

For more question about this article. You can contact me @
Email – [email protected]
Mobile No. – 09305235027 – TNT
FB Account – https://www.facebook.com/onnaj.soicalap
Or feel free to comment below

 

442,401

317,942

317,951

Top