6
Reply

In Form1, how to get a value from Main()?

Dave

Dave

Dec 7 2013 11:11 AM
941
Hi,

In button1_Click(), how can I get "aValue" from Main(), somthing like:

    static class Program
    {
        [STAThread]
        static void Main()
        {
            int aValue = 1;
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDe...
            Application.Run(new Form1());
        }
    }

    public partial class Form1 : Form
    {
        private void button1_Click(object sender, EventArgs e)
        {
            Console.WriteLine("aValue = " + aValue);
        }
    }

I will appreciated for your code, I am a beginner. 

Answers (6)