how do i copy textbox contents of 1 form to another form
Answers were Sorted based on User's Feedback
Answer / umedh singh
Hi
Windows Application Coding
##Form1##
on button_click event
Form2 f2 =new Form2();
f2.form1inform2=this;
f2.show();
##Form2##
public form1 form1inform2;//variable
on form2_load event
this.TextBox1.text=((form1)this.form1inform2).textbox1.text;
.........................................
Web Application coding use QueryString
on button_click event
Response.Redirect("Default2.aspx?a="+textBox1.text);
on page_load event
textBox1.text=Request.QueryString["a"].toString();
| Is This Answer Correct ? | 5 Yes | 2 No |
Answer / sreeni
both the above answers are correct. Use First Answer for
Web applications and Second one for Windows applications.
| Is This Answer Correct ? | 7 Yes | 5 No |
Answer / justin dhas
Hi,
By using state management variables you can get the value of textbox from one form to another,like querystring,session,cookies etc
eg)
Session["value"]=textboxid.Text;//Set the value in one form
string s=Session["value".ToString()//get the value in another form
| Is This Answer Correct ? | 12 Yes | 14 No |
Answer / vishal m.s.
In 2nd form create an object for the 1st form
And write a code as below
//Object creation for form1 in form2(on command Button)
Form1 f1 = new Form1();
TextBox1.Text = f1.TextBox1.Text;
| Is This Answer Correct ? | 4 Yes | 29 No |
how do i copy textbox contents of 1 form to another form
How to pass multiple rows from one gridview to another gridview after clicking the checkbox.
Write a program to convert postfix expression to infix expression.
program to reverse the order of words in a string.
program for addition of fraction(M/N + P/Q = Y/Z)
How to find No of classes,Packages,No of Methods per Classes and Depth of Inheritance for selecting source code in windows form application using c# .net? (Source code is input Program. It may be Java or .net) Please help me..) Thanks..)
"c sharp" code for factorial using static variables
program for string reverse(eg:- i am boy -> boy am i)
8 Answers Black Pepper, Infosys, Mind Tree,
How to Create Files by Using the FileInfo Class?
how to change password in .net with c # with ado.net and also SQL server 2008 change password
Hello Sir, Thanks for the Solution but, can you pls. Explain the coding for the Static Function & static variable from the below coding....waiting for Ans. class fact { public static void Main() { fact f=new fact(); int x=1; //Declaration of x as 1 int k=Convert.ToInt32(Console.ReadLine()); for(int i=1;i<=k;i++) { x= x *i; } System.Console.WriteLine(x); } }
c# code to Count number of 1's in a given range of integer (0 to n)