winforms - Button help c# Visual Studio -
i have button on widows form isn't working. form called form2
private void button1_click(object sender, eventargs e) { form1.setplayernames(p1.text, p2.text); this.close(); }
the code seems check 2 textboxes, , assigns them value in next form, form1 supposed linked. reason link doesn't work.
first, before open the form2 , set global variable is
public string textbox1value = ""; public string textbox2value = "";
then open the form2 form2.showdialog();
when calling button function, this...
private void button1_click(object sender, eventargs e) { textbox1value = p1.text; textbox2value = p2.text; this.close(); }
after close form2, below form2.showdialog(); put this,
form1.setplayernames(form2.textbox1value, form2.textbox2value );
try.
and realize 1 thing is, form1 appeared light blue color, trying call class function inside form1? without declare variable?
Comments
Post a Comment