c# - How to Display value of textbox in label in another form? -


hi i'm new c# , want display value of textbox1 in form1 label1 in form2. tried using this:

private void button1_click(object sender, eventargs e)     {         label1.text = textbox1.text;          form2 frm = new form2();         frm.show();         this.hide();     } 

but didn't work because it's in form. can tell me how right?

in form1 write code

private void button1_click(object sender, eventargs e) {         form2 form = new form2(textbox1.text);         form.show();     } 

in form2 write this

public form2(string text)     {         initializecomponent();         label1.text = text;     } 

Comments

Popular posts from this blog

xml - Extract substrings with XSLT -

math - "ELO Rating" and how does "TSR Rating" work? -

How can do a tuple comparison in coffeescript similar to that in python? -