Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

WindowsForm doesn't open again when closed in an add-in

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
Anonymous
291 Views, 2 Replies

WindowsForm doesn't open again when closed in an add-in

Hello community!

I've made a add-in for inventor with many windows-forms. But if one form has been closed when the addin in inventor is running, it doesn't open again. How can i avoid this problem? I read something about to use the .hide() command on the red-x-close-button in windows forms, but i couldn't get it work. Does anyone know the problem or a solution?

I'm looking forward to every idea, so i can finally finish my project.

Best regards
Colli

2 REPLIES 2
Message 2 of 3
manuel.lanthaler
in reply to: Anonymous

Hello,

 

there are two possibilites:

 

  • If you want to open the same form again, then you can hide and show the form as per your needs:

 

//while closing the window in the close event
this.Hide(); // hide the form instead of closing
e.Cancel = true; // this cancels the close event.

 

//While opening check like this
if(!form.Visible)
{
  form.Show();
}

 

  • If you dont want to open again the same, then you have to get sure that the form and all its child windows are closed / disposed correctly and you can create a new instance of the form using the new () operator.

 

hope it helps

 

Manuel

coolOrange
www.coolOrange.com
––––––––––––––––––
Please mark this response as "Accept as Solution" if it answers your question.
If you have found any post to be helpful, even if it's not a direct solution, then please provide that author kudos.


Message 3 of 3
Anonymous
in reply to: manuel.lanthaler

Thanks for your answer 🙂

I already found a solution but forgot to post it.

In my case i open a windowsform by clicking a selfmade button in the ribbon panel of inventor.
I had to place the constructor for the windowsform into the button_click handling sub, not above into the class.
If the constructor is placed in the class, only one windowsform object will be constructed by button click and if it gets closed it will not get constructed by every next button click.
When the constuctor is placed in the button_click sub, the windowsform objekt will be new constructed every time the button gets clicked.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report