public void OnMenuEvent(ref SAPbouiCOM.MenuEvent pVal, out bool Bubble) { Bubble = true; try { if (pVal.BeforeAction == true) { SAPbouiCOM.Form oForm = null; oForm = eCommon.SBO_Application.Forms.ActiveForm; String sXML = oForm.GetAsXML(); switch (pVal.MenuUID) { case "1293": break; case "1285": break; } } else { switch (pVal.MenuUID) { default: FormAttribute oAttrib = Forms[pVal.MenuUID] as FormAttribute; if (oAttrib != null) { try { //Execute the constructor System.Reflection.Assembly asm = System.Reflection.Assembly.GetExecutingAssembly(); Type oType = asm.GetType(oAttrib.TypeName); System.Reflection.ConstructorInfo ctor = oType.GetConstructor(new Type[0]); if (ctor != null) { object oForm = ctor.Invoke(new Object[0]); } else { throw new Exception("No default constructor found for form type - " + oAttrib.FormType); } } catch (Exception Ex) { eCommon.SBO_Application.MessageBox(Ex.Message); } } break; } } } catch (Exception Ex) { eCommon.SBO_Application.StatusBar.SetText(Ex.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error); } }