Release a Winform From NX Environment When Exit

My program are simple, the release file is a main.dll contains
(1) A .NET library class (*.dll) to call a Winform (Form1)
(2) Winform (Form1) with Exit Button

I would like NX release my main.dll one I hit the Exit Button on Form1

The issue:
+ If I include the GetUnloadOption in (1).NET linrary class, then it calls the Winform for a few seconds and everything is unloaded --> I cannot use the features on my Winform

+ If I include the GetUnloadOption in (2)Form1 (and even called it from Exit Button). NX still holds my Main.dll

Any idea to resolve this issue?


Public Function GetUnloadOption(ByVal dummy As String) As Integer
'Unloads the image immediately after execution within NX
GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately
End Function

Are you using a modal or modeless form? If modeless, then you will need to take care of what happens when the form is closed. Here are a few links that may be of interest to you (you may need a Siemens community site login to view them).

https://community.plm.automation.siemens.com/siemensplm/attachments/siem...

https://solutions.industrysoftware.automation.siemens.com/view.php?sort=...

Thanks, your help is much appreciated - The big problem to learn NX programming, to me, there is no actually text book. I am not sure my searching skill is bad or there are not enough/easy to find examples out there to achieve basic things.

the code mentioned here does work, no issues.

but I would like to know whether this type unloading cause any issues with other .dll's loaded on to NX.
I ask this because we have other standard automations running,
and when I try this method, they get affect, especially when using system threading option.
any help would be much appreciated.

Regards
Pradeep
#If it works, it works.