Click here to Skip to main content
15,910,878 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Can the input of textbox1 of form1 can be automatically written or generated on the textbox1 of form2.? Please help.. Thank you..

What I have tried:

I have no idea about this.. I search alot.. but i didn't got a single hint.. please help..
Posted
Updated 13-Mar-16 3:10am

Not automatically, no - but it's not difficult to do yourself.
The "relationship" between the two forms is important here: assuming the Form1 creates the instance of Form2 then there are basically two ways:
1) Create a Form2 constructor that takes a string parameter and pass the textbox content when you create the instance - this sets it once, and doesn't change it again, and can be used with Show or ShowDialog.
2) Create a property in Form2 and have Form1 set it from the instance it creates. This allows you to change the value in Form2 when it changes in Form1, and only really works with Show, not with ShowDialog.
If that isn't the case, then have a look at these:
Transferring information between two forms, Part 1: Parent to Child[^]
Transferring information between two forms, Part 2: Child to Parent[^]
Transferring information between two forms, Part 3: Child to Child[^]
They all contain example code which shows it in practice.
 
Share this answer
 
Hi,

There are lots of ways to pass values from one page to other.
1. Query String
2. Post Information from Source Page
3. Session State

References:

How to: Pass Values Between ASP.NET Web Forms Pages[^]

BinaryIntellect Knowledge Base | .Net & Web Development - Passing Values between ASP.NET Web Forms[^]

Code: Passing Data from One Web Forms Page to Another (Visual C#)[^]

Thanks,
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900