Submitted by JasonB81 on Tue, 05/05/2020 - 10:52
Forums:
I have a Winform that I was using to make a sort of "Wizard" for an assembly to edit a series of expression values. It was working okay when testing initially and now the form will not fully close when I click the close button. It wont let me recompile when I make a change because NX is still accessing the application. To get around this I have to fully kill my NX session which takes forever to reopen. Can anyone help me, this is my code for the close button.
Private Sub Button8_Click(sender As Object, e As EventArgs) Handles Button8.Click
If MsgBox("ARE YOU SURE YOU WOULD LIKE TO EXIT?", vbYesNo, "Confirm Exit") = vbYes Then
Form2.Close()
Form3.Close()
Me.Close()
End If
End Sub
re: closing forms
What .GetUnloadOption are you currently using in your code? The option you use will determine when your dll is unloaded from NX. The "AtTermination" option will hold onto your dll until the session of NX terminates (sounds like what you are currently using). The "Immediately" option will unload your dll code as soon as it finishes executing and the "Explicitly" option allows you to control when it gets unloaded.
UnloadOption
Below is what I am currently using, but I also tried it with "AtTermination". I was trying to read up on if I need to dispose of any variables of not. It just seems as if one of the NX objects are still active in my session so I cant alter the program and recompile because I get a message it is being used by NX.
Public Function GetUnloadOption(ByVal dummy As String) As Integer
'Unloads the image
GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately
End Function
Jason Burdette
re: closing forms
https://community.sw.siemens.com/s/question/0D74O000006ZYESSA4/unload-th...
This thread might help you, especially the posts by Yamada. He added form.Dispose to his code, perhaps it will help in your case as well.
Thank you
I got it from that thread thank you.
Jason Burdette