Trying to inherit variable "text" from Form 1 for use in Form 2????

Posted by JB on Stack Overflow See other posts from Stack Overflow or by JB
Published on 2010-04-30T01:27:03Z Indexed on 2010/04/30 1:27 UTC
Read the original article Hit count: 365

Filed under:
|

I have a Form 1 as listed below, im trying to inherit the variable text from it so i can compare is value in an if statement so i can output the file specified for that id number in Form 2...is this possible???

Form 1, where variable is being used:

public void button2_Click(object sender, System.EventArgs e) { timer1.Enabled = true;

        string text = textBox1.Text;
        Mainform = this;

        this.Hide();

}

Form 2 where im trying to use the variable:

if (text == "900456318") {

           System.Diagnostics.Process.Start("C:\\Users\\Joshua Banks\\Desktop\\Downtown_atlanta_night");

       }

       }

© Stack Overflow or respective owner

Related posts about c#

Related posts about winforms