Using the example from the Solidworks AddIn template.
They create a Property Manager Page (UserPMPage.cs) and show how to display the page. What seems to be missing is how to handle when the page is either canceled or accepted (green checkmark).
What I am interested in is how to detect if the user canceled the operation or accepted the operation and how to get the values of what was selected. In a C# Windows app (IIRC) you add the options in a groupbox and get the values from there. There does not seem to be any way to get which option was checked except by iterating all the options and examine each one.
How does the property manager page:
- Handle if it was canceled or not.
- Retrieving the values of the controls if they were used.

You need to capture the OnClosing notification in the property manager page handler. At this stage, your controls are not disposed so you can read the values from them. Alternatively, you can handle all the notification in the page handler (such as check box change, option box change, selection box change etc.) and update your data model immediately so it is available for you in After Close notification when controls are disposed.
Or you can simply use the code below (this is the code for your complete add-in, not a snippet):
This will create the following property manager page
And display the result once you close the page:
See attached project
Very cool. No I am not going to 3DWX, just the opposite in fact.I have been actively been doing demos to entertain getting out of Solidworks. I have become so irritated with the way that SW crashes. Crashes are something I have seen since becoming a customer in 2007. It hasn't mattered what we have tried (new hardware, install and use PDM, reinstall, change this or that setting, don't use this or that command, and the list goes on and on) and every support person has a different perspective on what is causing them. I have tried so many fixes over the years as prescribed by VAR tech support. I guess it's not that Solidworks crashes but that Solidworks leadership seems to place more emphasis on new features over stability. Usually the new features are of marginal use at best.
The most puzzling crash I have seen that keeps happening is when clicking on "File -> Open..." with and it crashes. Rarely are the crashes repeatable. Sigh....
It is my voice on the video Are you going to 3DXW? I will be presenting there on using frameworks for building advanced SW addins. I'm going to release new version of framework soon (complete rewrite) which will group property pages, addins and macro features and much much more.
WOW!!! - that Codestack is a freekin awesome framework! I spent yesterday evening and this morning reading up on this. HOLY SMOKES! There needs to be a software Oscar.
For those of you wondering Codestack is a free (at this point anyway) framework for making addins for Solidworks. It looks like it automates the tedious aspects of making an add in so you can focus on what you want to do with the add in. For me the video at the bottom of the page was essential to getting started. Be ready to hit pause a lot because the presenter is an advanced programmer and he moves pretty fast.
If you are using C# and don't know or understand attributes very well you'll want to bring yourself up to speed. They are not difficult but if you don't understand them you'll just be copying code you don't understand.
Who can I thank for writing Codestack?
This library is deployed as NuGet package. Simply select the following option from your Visual Studio solution and it will bring all the required libraries. It used to be automatic when you build, now in 2019 something has changed so you need to call this command explicitly (there might be some optino for this):
Here are some more information:
- Again, thank you for posting this. I have been studying the example you posted on and off most the afternoon. There is a whole lot I am either not familiar with or just don't understand. At first I was looking at the code image but then just loaded the project in VS 2019. Now that I have loaded the project itself I see that you are using some third party packages called CodeStack and SolidworksTools. Where would I find the correct versions of these for your project?
- I started thinking along those lines at lunch. I was not nearly as far along as your though. I still have issues not getting confused with Events.
Thanks for your extensive code example and help!