Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- FORM 1 -------------------------------------------------------------------------------------------
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- Form2 f = new Form2();
- f.Name = textBox1.Text;
- f.setName();
- f.ShowDialog();
- labelForm2Dish.Text = f.Lieblingsessen;
- }
- }
- FORM 2 -------------------------------------------------------------------------------------------
- public partial class Form2 : Form
- {
- private string formOneName;
- public string Name
- {
- set
- {
- formOneName = value;
- }
- }
- public string Lieblingsessen
- {
- get
- {
- return textBox1.Text;
- }
- }
- public void setName()
- {
- label3.Text = formOneName;
- }
- public Form2()
- {
- InitializeComponent();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- Close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement