Ramco Ramco

Ramco Ramco

  • 460
  • 2.8k
  • 399.7k

Error-Object reference is required for non-static field

Apr 19 2024 5:40 AM

Hi

  I have below code but i am getting above error on CreateConnection();

 

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

        [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 (1)