Message 1 of 3
Looping through object properties
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi guys and gals!
Long time listener (4 months) first time caller!
I'm looking to loop through an object, obtain its' property names and values, and then write those properties to a file. Using the forums and Goggle searches, I pasted the enclosed code together.
When I save the rule, it throws an error, "Error on Line 30 : Type 'oCircOccPattern' is not defined." oCircOccPattern is determined and passed from the Sub Main() area of the rule.
The error searches state that it is because the object type is determined at runtime. I tried passing the known object directly but it throws the same error.
Any help is greatly appreciated!
SyntaxEditor Code Snippet
Sub circularPattern (oCircOccPattern As CircularOccurrencePattern) strPath = (ThisDoc.PathAndFileName(False) & ".txt") Dim fso As Object fso = CreateObject("Scripting.FileSystemObject") Dim oFile As Object oFile = FSO.CreateTextFile(strPath) Dim myType As Type = GetType(oCircOccPattern) Dim properties As System.Reflection.PropertyInfo() = myType.GetProperties() For Each p As System.Reflection.PropertyInfo In properties ofile.writeline (p.Name) Next p oFile.Close fso = Nothing oFile = Nothing End Sub