Current location - Quotes Website - Signature design - I have two windows in C#, one is form 1 and the other is FORM2. How to get the value in formlabel from form2?
I have two windows in C#, one is form 1 and the other is FORM2. How to get the value in formlabel from form2?
Use? System;

Use? System. Assemble. Generics;

Use? System. Component model;

Use? System. Data;

Use? System. Drawing;

Use? System. Linq

Use? System. Text;

Use? System. Windows . Forms

//Note that the Lable property should be changed to public.

Namespace? Windows forms application 2

{

Public? Part? Class? Form 1? :? form

{

Public? Form 1 ()

{

initialize component();

}

Private? Invalid? Button 1_Click (object? Sender? EventArgs? e)

{

Form2? fr2? =? New? Form2 (this);

fr2。 show();

}

}

}

Use? System;

Use? System. Assemble. Generics;

Use? System. Component model;

Use? System. Data;

Use? System. Drawing;

Use? System. Linq

Use? System. Text;

Use? System. Windows . Forms

Namespace? Windows forms application 2

{

Public? Part? Class? Form2? :? form

{

Public? Form 2 ()

{

initialize component();

}

Private? Form 1? _ fr 1;

Public? Form2(Form 1? fr 1)

{

initialize component();

_fr 1? =? fr 1;

}

Private? Invalid? Form2_Load (object? Sender? EventArgs? e)

{

MessageBox。 Show (? _fr 1.label 1 text);

}

}

}