c# - Form not showing the variable from previous form -
i got 5 forms show 1 one: form1 > form2 > form3 > form4 > finalform.
every 1 has textbox , next button. problem can't variable textbox in form1 show @ finalform (the last one) in label6. problem?
form1:
namespace daneuzytkownika2 { public partial class form1 : form { nazwisko nazwisko = new nazwisko(); private string imie; public string ustawimie { { return imie; } set { imie = value; } } public form1() { startposition = formstartposition.centerscreen; initializecomponent(); } private void button1_click(object sender, eventargs e) { ustawimie = textbox1.text; hide(); nazwisko.showdialog(); } } } last form:
namespace daneuzytkownika2 { public partial class koncowainformacja : form { public koncowainformacja() { startposition = formstartposition.centerscreen; initializecomponent(); } private void koncowainformacja_load(object sender, eventargs e) { form1 form1 = new form1(); label6.text = form1.ustawimie; } } }
you're creating whole new instance of form1. why ever expect going contain data different instance of form1? if want pass data 1 form another, pass them. example, argument constructor, or making own showdialog method.
private void button1_click(object sender, eventargs e) { var form = new nawisko(textbox1.text); ... }
Comments
Post a Comment