Click here to Skip to main content
15,885,767 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear Programmers


i have two forms form1 and form2 ,form1 contain two textboxes and button ,at start of application form1 will open and i will enetr some numbers value in textboxes on click of the button, form2 will open , on form load event of form2 i want that textboxes value in variables
Posted

Below link points to an article which will give you closer look at many techniques

Passing Data Between Forms[^]

Regards..:)
 
Share this answer
 
v4
Create a Class file named something like Global and assign a static variable on that class file. Use that static variable to save the value and retrieve the value.

For Ex.

Private static strUSerid;

Global.strUserid = value;
 
Share this answer
 
You can use QueryString or Sessions to handle this,

Pass the textvalue in Query string
C#
Response.Redirect("WebForm1.aspx?Name="+txtbox1.Text);


And to get the querystring value you can use like this
C#
if (Request.QueryString["Name"]!= null)
    string txtValue = Request.QueryString["Name"];
 
Share this answer
 
v2
Comments
kiran murkal 2-Sep-13 1:55am    
Sorry Thomas i forget to mention i am using windows application
 
Share this answer
 
Best Way

1-

textbox txt_1=previuosPage.findControl("Txt_1") as textbox

Or

2- Create Session And Set Textbox Value Into To session:

Session.add("Sample",Txt_1.text)

Read Session:

var s=session["Sample"]
 
Share this answer
 
Comments
PIEBALDconsult 8-Nov-14 10:15am    
Please don't answer your own questions.

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