Message 1 of 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi, I'm trying to get a global parameter when closing the project (in the DocumentClosingEventArgs event). At the time of opening the project the function (in the DocumentOpenedEventArgs event) works fine, but when the project is closed the function does not yield anything.
Public Function GetGlobalParametersValues(ByVal document As Document, ByVal parametro As String) As String
Dim nChangedValues As String = ""
Using trans As Transaction = New Transaction(document, "Change global parameters values")
trans.Start()
Dim paramId As ElementId = GlobalParametersManager.FindByName(document, parametro)
Dim param As GlobalParameter = TryCast(document.GetElement(paramId), GlobalParameter)
Dim valParam As ParameterValue = param.GetValue()
Dim dvalue As StringParameterValue = TryCast(valParam, StringParameterValue)
nChangedValues = dvalue.Value
trans.Commit()
End Using
Return nChangedValues
End FunctionWill the "DOCUMENT" of DocumentOpenedEventArgs be different from the "DOCUMENT" of DocumentClosingEventArgs?
Solved! Go to Solution.