VB.Net Me.Close doesn't close whole add-in?

VB.Net Me.Close doesn't close whole add-in?

kmiller
Collaborator Collaborator
1,334 Views
3 Replies
Message 1 of 4

VB.Net Me.Close doesn't close whole add-in?

kmiller
Collaborator
Collaborator

Hi there,

 

Something to run by you guys.  I have an add-in built that is launched by a custom toolbutton on a custom ribbon panel.  In the form loading event I do some setting of custom iproperties to variables within the program.  If any of the iproperties don't exist I have this exception being caught due to the code being in a try - catch statement.  If the exception is caught I just display a message box with the error and then call me.close() to close the form/program.  Only problem is that it seems like it doesn't close or release everything.  Because when I look in the task manager it's still listed as running.  If I end the task and then attempt to run the program again (without launching inventor) I will get an "exception thrown @ target invocation" error upon loading.  The only way to get the program to run again and work on any file is to close down inventor and relaunch it.  Anyway I can fix this from happening?  Do I need to set the variable that holds my inventor application to nothing when closing if an exception/error is hit? 

-------------------------------------------------------------------------------------------------

If this response answers your question please click "Accept as Solution".
0 Likes
1,335 Views
3 Replies
Replies (3)
Message 2 of 4

kmiller
Collaborator
Collaborator

I take that back - then form does not stay open in the task scheduler it just will not load on a file that has the correct iproperties after it hits a file that does not have the correct ones.  It does nothing.  If I happen to re-try it on a file I know will not work my error in the form loading event does pop up.  I am still thinking maybe there is something in there I need to release from memory??  

-------------------------------------------------------------------------------------------------

If this response answers your question please click "Accept as Solution".
0 Likes
Message 3 of 4

xiaodong_liang
Autodesk Support
Autodesk Support
Hi,

I am confused with your scenario. Since it is an addin, what is the process you killed by Task Manager? In addition, could you provide a small. reproducible sample, including the neccessary steps?
0 Likes
Message 4 of 4

kmiller
Collaborator
Collaborator

I can't recall.  I had thought I killed my addin but then when I went back to go and test my steps again to make sure I had things correct my addin wasn't there to kill.  I am wondering if maybe I killed my VB Express program instead.  To be honest, I should have paid more attention to that part of it.  The small button pusher part of me got the best of me this time.  I did open a support request on it too but haven't heard anything back yet.   The biggest thing I would like to fix is having the program go back to re-loading if this situation happens and to not have the user have to re-launch inventor.  I checked the forums for VB and using the me.close is supposed to be the way to close the form and release everything.  I am also using the show method to show the form not showdialog as from my understanding is these may function differently.

-------------------------------------------------------------------------------------------------

If this response answers your question please click "Accept as Solution".
0 Likes