SW Api (Property Manager) and C#

I have implemented IPropertyManagerPage2Handler3 like somebody did it in SW Example

formatting link
in PMPHandler.cs. Only i changed is a constructor:

public PMPageHandler (ISldWorks swApplication) { swApp = swApplication; }

In User PMPage (named as PMPUserPage)

public class PMPUserPage { IPropertyManagerPage2 swPropertyPage; PMPageHandler handler;

IPropertyManagerPageButton button1; public const int button1ID = 0;

ISldWorks swApp; public PMPUserPage(ISldWorks swApplication) { swApp = swApplication; CreatePropertyManagerPage(); } protected void CreatePropertyManagerPage() { int errors = -1; int options = (int)SwConst.swPropertyManagerPageOptions_e.swPropertyManagerOptions_OkayButton | (int)SwConst.swPropertyManagerPageOptions_e.swPropertyManagerOptions_CancelButton; handler = new PMPageHandler(swApp);

swPropertyPage = (IPropertyManagerPage2)swApp.CreatePropertyManagerPage("Title", options, handler, ref errors); AddControls(); this.Show(); }

So, when it runs then on line (3rd from down) with (swPropertyPage = (Iproperty...) i get "Specified cast is not valid." It's a problem with handler, when i set handler=null then my property page will be shown in SolidWorks document. What am I doing wrong? Should I also implement ISwAddin?

Thanks in advance.

Reply to
-=RapidHail=-
Loading thread data ...

I finded the answer, the problem was in an AssemblyInfo.cs line: [assembly: ComVisible(false)]

Everything works now :-)

Reply to
-=RapidHail=-

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.