Reply

Activate Hadrware Part property

[ Edited ]

 

I have a VB6 program which adds various custom properties to a part file but I would like to make the 'Hardware part' property in the Project tab active when the program is run. Can anyone pleae help with the code to do this?

 

Posted by: Paul Collins
Post date: 1/5/2009 8:49:43 PM

6 REPLIES

RE: Activate Hadrware Part property

[ Edited ]

Paul,

 

If you've got a handle to the part model:

 

objDoc.Properties.Item("ExtendedSummaryInformation").Item("Hardware").Value = True

 

 

 

Posted by: Bill Ledbetter
Post date: 1/6/2009 12:38:31 AM

RE: Activate Hadrware Part property

[ Edited ]

Cheers Bill. it worked a treat.

 

Posted by: Paul Collins
Post date: 1/6/2009 12:47:39 AM

Re: RE: Activate Hadrware Part property

Has anyone got any idea why this doesn't seem to work in visual studio (2013). I just get an error message:-

A first chance exception of type 'System.Runtime.InteropServices.COMException' occurred in mscorlib.dll

Additional information: Invalid index. (Exception from HRESULT: 0x8002000B (DISP_E_BADINDEX))

 

This is the full error message

System.Runtime.InteropServices.COMException occurred
  ErrorCode=-2147352565
  HResult=-2147352565
  Message=Invalid index. (Exception from HRESULT: 0x8002000B (DISP_E_BADINDEX))
  Source=""
  StackTrace:
       at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
       at SolidEdgeFramework.Properties.Item(Object vIndex)
       at SE_Data_JCBT.Module1.WriteTextBoxes() in C:\Visual Studio Desktop\SE_Data_JCBT\Module1.vb:line 220
  InnerException:

 

Re: RE: Activate Hadrware Part property

Hi,

 

the error indicates that the property you're trying to access can't be found.

So check for possible spelling error and be aware that the property "Hardware" of the category "ExtendedSummaryInformation" is available only for PAR/PSM documents.

 

Kind regards,
Wolfgang Kunert - www.wksyspro.de

Re: RE: Activate Hadrware Part property

Hi Wolfgang,

I realsied that the property couldn't be found but the same code still works OK in VB6. I tried another couple of ExtendedSummaryInformation properties and they worked. Maybe it is a Visual Studio problem. If it can't bo done I will have to forget it - it was just a nice option to include in my program.

Thanks for your help.

Re: RE: Activate Hadrware Part property

Hi,
you can use the HardwareFile Property of the PartDocument object (Boolean)
regards

JB
VS2015, SE ST10