I have to add 80 Xdata to some objects. How to populate them within a loop. This what I did for 11 of them . But
I am pretty sure there is a way to do it in a loop which I don't know . Any help from experts would be appreciated.
Public Sub SetXData2()
Dim doc As Document = Application.DocumentManager.MdiActiveDocument
Dim ed As Editor = doc.Editor
' Ask the user to select an entity
' for which to set XData
Dim opt As New PromptEntityOptions(vbLf & "Select entity: ")
Dim res As PromptEntityResult = ed.GetEntity(opt)
If res.Status = PromptStatus.OK Then
Dim tr As Transaction = doc.TransactionManager.StartTransaction()
Using tr
Dim obj As DBObject = tr.GetObject(res.ObjectId, OpenMode.ForWrite)
AddRegAppTableRecord1("Hello")
Dim rb As New ResultBuffer(New TypedValue(1001, "Hello"), _
New TypedValue(1000, "test1"), New TypedValue(1000, "test2") _
, New TypedValue(1000, "test3"), New TypedValue(1000, "test4") _
, New TypedValue(1000, "test5"), New TypedValue(1000, "test6") _
, New TypedValue(1000, "test7"), New TypedValue(1000, "test8") _
, New TypedValue(1000, "test9"), New TypedValue(1000, "test10") _
, New TypedValue(1000, "test11"))
obj.XData = rb
rb.Dispose()
tr.Commit()
End Using
End If
End Sub