Click here to Skip to main content
15,881,850 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
How can i pass some value from one from to another from when i perform and submit click?
Posted
Comments
Maksud Saifullah Pulak 1-Dec-12 9:47am    
Can You please clear it weather it is winfrom for asp pages.

You can send it as follows:

Suppose from from one to from two you want to pass you require values.
C#
string value1,value2;
int value3,value4;

protected void btn_click(objectbtn sender, eventarg e)
{

   from2 obj=new from2(value1,value2,value3,value4);

   obj.show(); 
}

on in the from2 you just initialize the value in a constructor and get those value.

Hope this helps.
Thanks.
 
Share this answer
 
v2
Comments
Thomas Daniels 1-Dec-12 11:53am    
Good answer, +5!
Maksud Saifullah Pulak 1-Dec-12 11:59am    
Thanks.
Rahul Bormon 1-Dec-12 12:41pm    
Thanks Maksud Saifullah.
Maksud Saifullah Pulak 1-Dec-12 12:44pm    
Welcome.
 
Share this answer
 
Comments
Rahul Bormon 1-Dec-12 9:50am    
Oh it is windows from.
__TR__ 1-Dec-12 9:54am    
The links show how to do it in windows application not web application.
You can send your value and in new for store it to your general data types:

C#
string value1,value2;
int value3,value4;

protected void btn_click(objectbtn sender, eventarg e)
{

   from2 obj=new from2(value1,value2,value3,value4);

   obj.show();
}

---------------------------------------------------------------------
In new form do this:
public class form2
{
     //General Data types
     string value1,value2;
     int value3,value4;
     //cosntructor  
     form2(string value1,string value2,int value1,int value2)
     {
//store it to general data types so you can use it all over your calss  
         this.value1=value1;
         this.value2=value2;    
         this.value3=value3;
         this.value4=value4;
     }
}
 
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