Option Infer On Imports System Imports System.Runtime.InteropServices Namespace Examples Friend Class Program <STAThread> Shared Sub Main(ByVal args() As String) Dim application As DesignManager.Application = Nothing Dim propertySets As DesignManager.PropertySets = Nothing Dim properties As DesignManager.Properties = Nothing Dim [property] As DesignManager.Property = Nothing Try application = New DesignManager.Application() propertySets = CType(application.PropertySets, DesignManager.PropertySets) propertySets.Open("C:\Part1.par", False) properties = CType(propertySets.Item("Custom"), DesignManager.Properties) [property] = CType(properties.Add("My Custom Property", "My Custom String"), DesignManager.Property) propertySets.Save() Catch ex As System.Exception Console.WriteLine(ex) End Try End Sub End Class End Namespace
using System; using System.Runtime.InteropServices; namespace Examples { class Program { [STAThread] static void Main(string[] args) { DesignManager.Application application = null; DesignManager.PropertySets propertySets = null; DesignManager.Properties properties = null; DesignManager.Property property = null; try { application = new DesignManager.Application(); propertySets = (DesignManager.PropertySets)application.PropertySets; propertySets.Open(@"C:\Part1.par", false); properties = (DesignManager.Properties)propertySets.Item["Custom"]; property = (DesignManager.Property)properties.Add("My Custom Property", "My Custom String"); propertySets.Save(); } catch (System.Exception ex) { Console.WriteLine(ex); } } } }