Passing Value from Form2 to Form1

Discussion in 'C#' started by happyandrea, Sep 10, 2010.

  1. happyandrea

    happyandrea New Member

    Sep 10, 2010
    Likes Received:
    Trophy Points:
    I have this button in Form2 that when is clicked, a string value is passed back to Form1 and it is displayed in a textbox.
    public partial class Form2 : Form
    double a, b, ave;
    string stype;
    Form1 frm = new Form1();

    public Form2(double x, double y)
    a = x; b = y;
    ave = (a + b) / 2;


    private void button2_Click(object sender, EventArgs e)
    frm.textBox6.Text = stype;
    textBox6 Modifiers is already Public.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice