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

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -