0

Below is my code

private void btnCptKb5_Click(object sender, EventArgs e)
{ 
   Form1 form1 = new Form1();
   textbox1.text = form1.textbox1.text;
}

Why is that I can't copy the value of form1 textbox?

User2012384
  • 4,769
  • 16
  • 70
  • 106
Lucas Juan
  • 351
  • 5
  • 9
  • 23
  • It's not really clear what you're trying to achieve here. What do you mean by not being able to copy? – Szymon Jan 21 '14 at 04:34
  • 1
    Because you just created a brand new form with no data. – SLaks Jan 21 '14 at 04:35
  • You've created the form but done nothing else - what are you expecting to copy? Have you populated the textbox with a value? – slugster Jan 21 '14 at 04:37
  • I think...the above code won't compile, do you want to say Form1 form1 = new Form1()? By the way, form1 is a new object which contains no data – User2012384 Jan 21 '14 at 04:37
  • sorry for my english. the btnCptKb5_Click is from form 2 and I want to copy the value I inputted from form1 textbox? How can I do it? – Lucas Juan Jan 21 '14 at 04:39

1 Answers1

5
Community
  • 1
  • 1
Selman Genç
  • 100,147
  • 13
  • 119
  • 184