static void Main(string[] args)
 {
     try
     {
         Application oApp = null;
         if (args.Length < 1)
         {
             oApp = new Application();
         }
         else
         {
             oApp = new Application(args[0]);
         }
         Menu MyMenu = new Menu();
         MyMenu.AddMenuItems();
         oApp.RegisterMenuEventHandler(MyMenu.SBO_Application_MenuEvent);
         Application.SBO_Application.AppEvent += new SAPbouiCOM._IApplicationEvents_AppEventEventHandler(SBO_Application_AppEvent);
         // events handled by SBO_Application_MenuEvent
         Application.SBO_Application.MenuEvent += new SAPbouiCOM._IApplicationEvents_MenuEventEventHandler(SBO_Application_MenuEvent);
         // events handled by SBO_Application_ItemEvent
         Application.SBO_Application.ItemEvent += new SAPbouiCOM._IApplicationEvents_ItemEventEventHandler(SBO_Application_ItemEvent);
         // events handled by SBO_Application_FormDataEvent
         Application.SBO_Application.FormDataEvent   += new SAPbouiCOM._IApplicationEvents_FormDataEventEventHandler(SBO_Application_FormDataEvent);
         Application.SBO_Application.RightClickEvent += new SAPbouiCOM._IApplicationEvents_RightClickEventEventHandler(SBO_Application_RightClickEvent);
         Conexion.Conectar_Aplicacion();
         oCompany = Conexion.oCompany;
         Funciones.AgregarUDF_Salida_Inventario();
         NVerificaAgregaUDO.VerificarCrearUDO();
         oApp.Run();
     }
     catch (Exception ex)
     {
         System.Windows.Forms.MessageBox.Show(ex.Message);
     }
 }
        static void Main(string[] args)
        {
            try
            {
                Application oApp = null;
                if (args.Length < 1)
                {
                    oApp = new Application();
                }
                else
                {
                    oApp = new Application(args[0]);
                }
                Menu MyMenu = new Menu();
                MyMenu.AddMenuItems();
                oApp.RegisterMenuEventHandler(MyMenu.SBO_Application_MenuEvent);
                Application.SBO_Application.AppEvent        += new SAPbouiCOM._IApplicationEvents_AppEventEventHandler(SBO_Application_AppEvent);
                Application.SBO_Application.MenuEvent       += new SAPbouiCOM._IApplicationEvents_MenuEventEventHandler(SBO_Application_MenuEvent);
                Application.SBO_Application.ItemEvent       += new SAPbouiCOM._IApplicationEvents_ItemEventEventHandler(SBO_Application_ItemEvent);
                Application.SBO_Application.RightClickEvent += new SAPbouiCOM._IApplicationEvents_RightClickEventEventHandler(SBO_Application_RightClickEvent);

                Capa_Datos.Conexion.Conectar_Aplicacion();
                oCompany = Capa_Datos.Conexion.oCompany;

                Funciones.sCodUsuActual     = Capa_Datos.Conexion.sCodUsuActual;
                Funciones.sAliasUsuActual   = Capa_Datos.Conexion.sAliasUsuActual;
                Funciones.sNomUsuActual     = Capa_Datos.Conexion.sNomUsuActual;
                Funciones.sCurrentCompanyDB = Capa_Datos.Conexion.sCurrentCompanyDB;

                NVerificaAgregaUDO.VerificarCrearUDO();

                oApp.Run();
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message);
            }
        }