dotnetspider.com
Login Login    Register      

TutorialsForumCareer DevelopmentResourcesReviewsJobsInterviewCommunitiesProjectsTraining

Subscribe to Subscribers
Talk to Webmaster
Tony John

Facebook
Google+
Twitter
LinkedIn
Online MembersUltimaterengan
rubseenahanan
Ranipriya
More...
Join our online Google+ community for Bloggers, Content Writers and Webmasters




Forums » .NET » .NET »

how to take Textbox Value from Form1 to Form 2. - in VB.net using c#


Posted Date: 13 Mar 2008      Posted By:: senthil kumar     Member Level: Silver    Member Rank: 0     Points: 2   Responses: 4



how to take Textbox Value from Form1 to Form 2. - in windows appl. using c#



Responses

#201578    Author: MK      Member Level: Gold      Member Rank: 0     Date: 13/Mar/2008   Rating: 2 out of 52 out of 5     Points: 2

session("uname")= textbox1.text

another page

assign vice versa

With Regards,

Muthukrishnan S,


Software Programmer




Mobile : +91 99945 84009















 
#201584    Author: DhivyaSelvadurai      Member Level: Gold      Member Rank: 0     Date: 13/Mar/2008   Rating: 2 out of 52 out of 5     Points: 2

1. add a class file and create shared variables
2. assign the textbox value of form1 to the variable
3. read that in the second form

sample below
//class file
public class Class1
{
public static string aa;
public Class1()
{
}
}
//in form 1
private void button1_Click(object sender, System.EventArgs e)
{
Class1.aa=textBox1.Text;
Form2 obj=new Form2();
obj.Show();
}

//in form 2

private void Form2_Load(object sender, System.EventArgs e)
{
textBox1.Text=Class1.aa;
}



 
#201590    Author: Kalyan      Member Level: Gold      Member Rank: 277     Date: 13/Mar/2008   Rating: 2 out of 52 out of 5     Points: 2

Session["Name"].text=textbox1.text.tostring();

in form 2

string name=Session["Name"].text.Tostring();

Like this






 
#203580    Author: senthil kumar      Member Level: Silver      Member Rank: 0     Date: 18/Mar/2008   Rating: 2 out of 52 out of 5     Points: 2

in Class 1
-----------

public static string aa;

in Form1
----------
class.aa=textbox1.Text;

in Form2
---------
textbox1.text=class.aa

------------------------------------------

Detailed Code Below
~~~~~~~~~~~~~~~~~~~~~~~~~~``

Class 1
---------


namespace qq
{
public class Class1
{
public string aa;
}

}

Form1
-----------
namespace qq
{
public partial class Form1 : Form
{




private void button1_Click(object sender, EventArgs e)
{

Class1.aa= textBox1.Text;

Form2 obj = new Form2();
obj.Show();

}}

Form 2
-----------------------

namespace qq
{
public partial class Form1 : Form
{
qq.Class1 _objclass = new qq.Class1();

public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{

Class1.aa= textBox1.Text;

Form2 obj = new Form2();
obj.Show();


} }}




 
Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.



Next : how to refresh the gridview while clicking clear button?
Previous : radibutton
Return to Discussion Forum
Post New Message
Category:

Related Messages



Follow us on Twitter: https://twitter.com/dotnetspider

Active Members
TodayLast 7 Daysmore...

Awards & Gifts
Email subscription
  • .NET Jobs
  • .NET Articles
  • .NET Forums
  • Articles Rss Feeds
    Forum Rss Feeds


    About Us    Contact Us    Copyright    Privacy Policy    Terms Of Use    Revenue Sharing sites   Advertise   Talk to Tony John
    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India
    2005 - 2012 All Rights Reserved.
    .NET and other trademarks mentioned in this site belong to Microsoft and other respective trademark owners.
    Articles, tutorials and all other content offered here is for educational purpose only.
    We are not associated with Microsoft or its partners.