AnsweredAssumed Answered

Custom Propertie & Info Not Saved

Question asked by Willie Roelofs on Jun 17, 2015
Latest reply on Jun 18, 2015 by Willie Roelofs

I have a userform with a couple of textboxes.

 

When the userform is activated all the textboxes will be filled with the currently stored data.

 

When I edit a textbox, I want to save that information in the correct custom property.

 

The data however is not saved. I wish to know what I'm doing wrong.
[code]

Dim swApp          As SldWorks.SldWorks
Dim swModel        As ModelDoc2
Dim swModelExt     As SldWorks.ModelDocExtension
Dim swAssy         As SldWorks.AssemblyDoc
Dim swSelMgr       As SldWorks.SelectionMgr
Dim swComp         As SldWorks.Component2
Dim name           As Variant
Dim names          As Variant
Dim textexp        As String
Dim evalval        As String

Dim OmschrijvingGevonden    As Boolean

Dim NabehandelingGevonden   As Boolean
Dim RevisionGevonden   As Boolean
Dim GetekendGevonden   As Boolean
Dim GewijzigdGevonden  As Boolean

 

Private Sub UserForm_Initialize()

 

Set swApp = SolidWorks.Application.SldWorks

Set swModel = swApp.ActiveDoc

Set swModelExt = swModel.Extension

Set swCustPropMgr = swModel.Extension.CustomPropertyManager("")

names = swCustPropMgr.GetNames

 

For Each name In names

    swCustPropMgr.Get2 name, textexp, evalval

   

    If name = "Description" Then

        NrSave1.benaming.Text = evalval

        OmschrijvingGevonden = True

    End If

       

    If name = "Nabehandelingofniet" Then

        NrSave1.nabehandeling.Text = evalval

        NabehandelingGevonden = True

    End If

   

    If name = "EIT-Getekend" Then

        NrSave1.getekend.Text = evalval

        GetekendGevonden = True

    End If

   

    If name = "EIT-Revision" Then

        NrSave1.revisie.Text = evalval

        RevisionGevonden = True

    End If

   

Next name

 

If OmschrijvingGevonden = False Then retval = swModel.AddCustomInfo3("", "EIT-Omschrijving", swCustomInfoText, "")

If NabehandelingGevonden = False Then retval = swModel.AddCustomInfo3("", "Nabehandelingofniet", swCustomInfoText, "")

If GetekendGevonden = False Then retval = swModel.AddCustomInfo3("", "EIT-Getekend", swCustomInfoText, "")

If RevisionGevonden = False Then retval = swModel.AddCustomInfo3("", "EIT-Revision", swCustomInfoText, "")

 

End Sub

 

Private Sub knop4_Click()

 

Set swApp = SolidWorks.Application.SldWorks

Set swModel = swApp.ActiveDoc

 

Set swCustPropMgr = swModel.Extension.CustomPropertyManager("")

swCustPropMgr.Set "Description", benaming.Text

swCustPropMgr.Set "Nabehandelingofniet", nabehandeling.Text

swCustPropMgr.Set "EIT-Getekend", getekend.Text

swCustPropMgr.Set "EIT-Revision", revisie.Text

Set swCustPropMgr = swModel.Extension.CustomPropertyManager("Default")

swCustPropMgr.Set "EIT-Gewijzigd", gewijzigd.Text

 

End Sub

[/code]

Outcomes