From: -=RapidHail=- on
I have implemented IPropertyManagerPage2Handler3 like somebody did it in SW
Example
http://files.solidworks.com/API/Examples/00000/0300s/0345/Example.htm 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.


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

Everything works now :-)


 | 
Pages: 1
Prev: hem does not unbend
Next: swApp Events and C#