using System; using System.Drawing; using System.Windows.Forms; namespace Elso { public class Form1 : Form { Button mutatGomb = new Button(); Button valtoztatGomb = new Button(); Form2 form2 = new Form2(); public Form1() { mutatGomb.Text = "Mutat"; mutatGomb.Location = new Point(112, 50); valtoztatGomb.Text = "Változtatása"; valtoztatGomb.Location = new Point(112, 90); mutatGomb.Click += new EventHandler(Button_Click); valtoztatGomb.Click += new EventHandler(ValtoztatButton_Click); Controls.Add(mutatGomb); Controls.Add(valtoztatGomb); } static public void Main() { Application.Run(new Form1()); } private void Button_Click(object sender, EventArgs e) { form2.Show(); } private void ValtoztatButton_Click(object sender, EventArgs e) { form2.gomb.Text = "Új szöveg"; form2.textbox1.Text = "Én is változom"; } } public class Form2 : Form { public Button gomb = new Button(); public TextBox textbox1 = new TextBox(); public Form2() { gomb.Text = "Verseny"; gomb.Location = new Point(112, 50); textbox1.Location = new Point(112, 100); Controls.Add(gomb); Controls.Add(textbox1); } } }