2 Replies - 1296 Views - Last Post: 16 October 2011 - 05:22 PM Rate Topic: -----

#1 wasenmel  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 35
  • Joined: 29-March 11

passing data between forms

Posted 16 October 2011 - 02:57 PM

i'm trying to send a text between two forms , form1 contains a button and a text. form2 contains a button and a text.
when i write in text in form1 and click the button in form1 , i'm supposed to go to form2 and display the text that was written in form1( BY CLICKING THE BUTTON IN FORM2 THAT DISPLAYS IN THE TEXT ).
my problem is that after i write in text and click button to go to the next form , the text i've written automatically appears in the text without me clicking the button .
public form2(string str)//in form2
{
InitializeComponent();

  textbox.Text = s;//textbox in form2 that i want to display in
{

//form1
private void button1_Click(object sender, EventArgs e)
        {
form2 sForm = new form2(textBox1.Text);//textbox in form1 that i want to send
            sForm.Show();
}

i just cant figure out how to use another button(in form2)to make display the text from form1 to form2

Is This A Good Question/Topic? 0
  • +

Replies To: passing data between forms

#2 AdamSpeight2008  Icon User is offline

  • MrCupOfT
  • member icon

Reputation: 2298
  • View blog
  • Posts: 9,535
  • Joined: 29-May 08

Re: passing data between forms

Posted 16 October 2011 - 02:59 PM

Have a look in the tutorial section of this site, and you'll find a tutorial covering this.
Was This Post Helpful? 0
  • +
  • -

#3 eclipsed4utoo  Icon User is offline

  • Not Your Ordinary Programmer
  • member icon

Reputation: 1533
  • View blog
  • Posts: 5,972
  • Joined: 21-March 08

Re: passing data between forms

Posted 16 October 2011 - 05:22 PM

Here are 2 tutorials that we have.

Passing Data Between Forms
How To Get Values From Form1 To Form2 (Or Any Other Forms)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1