c# - Lables reading a text box -
this question has answer here:
- send values 1 form form 14 answers
can use label 1 form read data entered textbox on form? example entering number in text box , having information displayed label on other form
sure, it's not rough. general concept source form (where textbox resides) supplies necessary value destination form (where label resides). here small example:
sourceform:
namespace datatransferbetweenforms { public partial class sourceform : form { public sourceform() { initializecomponent(); } private void button1_click(object sender, eventargs e) { var destinationform = new destinationform(); destinationform.labeltext = textbox1.text; destinationform.show(); } } }
destinationform:
namespace datatransferbetweenforms { public partial class destinationform : form { public string labeltext { { return label1.text; } set { label1.text = value; } } public destinationform() { initializecomponent(); } } }
now when sourceform's button1_click event triggered, instance of destinationform created, label's text property set, , destinationform instance shown.
Comments
Post a Comment