i have created two winforms ,first from take a value and pass it into the second form and display on a label, but when i run the programme it throws exception

form 1

private void button1_Click(object sender, EventArgs e)
        {
              Form2 fm2 = new Form2(this.txtName.Text);
              fm2.Show();
        }

form 2

Form2 Constructor

public Form2(string parm)
        {
            this.label1.Text = parm;
            InitializeComponent();
        }

Recommended Answers

All 2 Replies

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.