Hi all,
My company has a custom property named 'Released date, Type Date.
This date is still empty
I am working on a rule that adds all the custom properties required for the company title block.
This rule can be useful whenever you get a model from a supplier.
I can add a custom property date using the following code:
Dim oDoc As Document = ThisApplication.ActiveDocument
Dim customPropertySet As PropertySet = oDoc.PropertySets.Item("Inventor User Defined Properties")
Try
iProperties.Value("Custom", "Released Date") = iProperties.Value("Custom", "Released Date")
Catch
Dim DateValue As Date = Now 'System.DBNull.Value
customPropSet.Add(DateValue, "Released Date")
End Try
This code works but sets the released date to Now.
But the release date needs to remain blank when adding.
I tried to make the value Null but I get the error:
"Value of type 'System.DBNull' cannot be converted to 'Date'."
Is there a way to keep a custom property date blank?
Thx in advance,
Arnold
Solved! Go to Solution.
Solved by xiaodong_liang. Go to Solution.
Hi,
please give it a try with
Imports System Dim nullDate As Nullable iProperties.Value("Custom", "aaa") = nullDate
Works!
I had to add it accordingly (first create date, then make it nulldate):
Dim customPropertySet As PropertySet = oDoc.PropertySets.Item("Inventor User Defined Properties")
DimDateValueAsDate=Now
customPropertySet.Add(DateValue, "Released Date")
Dim nullDate As Nullable
iProperties.Value("Custom", "Released Date") = nullDate
Thanks!
Hi,
I would like to create an external rule, wich can be setted some parameter.
I have some problem with date variable.
I use the following code:
Dim nullDate As Nullable
iProperties.Value("Custom", "04. Szállítási határidő - T")=nullDate
After I run this rule the Type of properties stay Text and do not Date format. The Value of properties changes to blank.
I tried the following code:
iProperties.Value("Custom", "04. Szállítási határidő - T")=CDate("nullDate")
This code can not work.
I attach a picture, where you can see what I want to get.