Ramco Ramco

Ramco Ramco

  • 440
  • 3.4k
  • 515.9k

Global variables in Windows Form Application.

Apr 19 2024 8:21 AM

Hi

  IN windows form application i want to use Global variables. Where i should declare them

public static SAPbouiCOM.Application oApplication = null;
        public static SAPbobsCOM.Company oCompany = null;

namespace Employee
{
    static class Program
    {
        public static SAPbouiCOM.Application oApplication = null;
        public static SAPbobsCOM.Company oCompany = null;

        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main(string[] args)
        {
            try
            {
                CreateConnection();
                Menu oMenuItems = null;
                oMenuItems = new Menu();

                //  Start Message Loop
                System.Windows.Forms.Application.Run();
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message);
            }
        }
    }
}

Thanks


Answers (2)