I have a product configurator that I would like to close/exit automatically via code based on selections made by a user. So basically mimic the same function as the red cross button at the top-right corner of our screens. But I have been unable to use Environment.Exit(), Application.Exit() and Application.ExitThread() successfully as they close not just the configurator but the whole epicor application. Is there a way I can achieve this in c# in the configurator. Essentially a way to mimic the red cross button to close application in code will work too but I donât know how to go about it.
Thanks Jeremy, but I tried it doesnât work because in this case âthisâ points to the TemporaryPageEventCollection instance and not the form itself.
Thanks Evan!! That seems to work. I added frm.Close(); method after your code and it closes the form but its giving me the following error right after it closes the form:
Message: System.NullReferenceException: Object reference not set to an instance of an object.
at Ice.Lib.Framework.EpiTransaction.setEDVNotificationState()
at Ice.Lib.Framework.EpiTransaction.ResumeNotifications()
at Erp.UI.Cfg.TESTbef968eea7a74b13ac8039f9ee50a364.Controllers._QA3_TempController.ControllerResumeNotifications() in c:\Users\mimtiaz\AppData\Local\Temp\314\ConfigDump\Client_QA3_TempController.cs:line 1963
at Erp.Lib.Configurator.Runtime.SystemFunctionsLib.ResumeNotifications()
at Erp.UI.Cfg.TESTbef968eea7a74b13ac8039f9ee50a364._QA3_TempPageEventCollection.Page1Loaded(PageChangeArgs Args) in c:\Users\mimtiaz\AppData\Local\Temp\314\ConfigDump\Client_QA3_TempPageEventCollection.cs:line 247
at Erp.Shared.Lib.Configurator.MethodCollection1.Invoke(String methodName, TMethodArgs args) at Erp.Lib.Configurator.Runtime.ConfigurationController1.TriggerPageEvent(Int32 callerPageSeq, PageChangeArgs args)
at Erp.Lib.Configurator.Runtime.ConfigurationController`1.PageLoaded(PagingDirection direction)
at Erp.UI.Cfg.TESTbef968eea7a74b13ac8039f9ee50a364.Controllers._QA3_TempController.Erp.Lib.Configurator.Runtime.IConfigurationController.PageLoaded(PagingDirection )
at Erp.UI.App.ConfigurationRuntimeEntry.Transaction.StartConfiguration(Boolean& needsUserInput, String inSmartString)
Program: Erp.UI.ConfigurationRuntimeEntry.dll
Method: StartConfiguration
Client Stack Trace
at Erp.UI.App.ConfigurationRuntimeEntry.Transaction.StartConfiguration(Boolean& needsUserInput, String inSmartString)
at Erp.UI.App.ConfigurationRuntimeEntry.Transaction.GetNextConfiguration(Boolean& needsUserInput, Boolean overrideLastConfig, Boolean fromSaveConfiguration)
at Erp.UI.App.ConfigurationRuntimeEntry.ConfigurationRuntimeForm.LaunchForm(Object options)
Does this have to do with the event handler? If yes, is there a way to dispose it?