.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Delete xrecord from Dictionary

4 REPLIES 4
Reply
Message 1 of 5
Anonymous
1130 Views, 4 Replies

Delete xrecord from Dictionary

Hello,

I have problem with below code. I opet transaction, select O (polyline entity).
Entity O have previos added xrecord with name key.
With this code I delete record, but when I finish sub and dispose tranaction trans xrecord
stay in entity... I dont now wath is wrong.


Please Tony T. or some others for some advice...


{code}


Public Shared Sub DeleteXRecord(ByVal o As Entity, ByVal key As String, ByVal trans As Transaction)

Try

Using dict As DBDictionary = TryCast(trans.GetObject(o.ExtensionDictionary, OpenMode.ForWrite, False), DBDictionary)

If dict.Contains(key) Then

Dim objid As ObjectId = dict.GetAt(key)
Dim xRecord As Xrecord = DirectCast(trans.GetObject(dict.GetAt(key), OpenMode.ForWrite), Xrecord)

xRecord.Erase()

dict.Remove(objid)

Else
End If

dict.Dispose()

End Using

Catch ex As Exception
MsgBox("Error")
End Try

End Sub

{code}
4 REPLIES 4
Message 2 of 5
Anonymous
in reply to: Anonymous

Where is your transaction? Nothing will happen without using a transaction and committing that transaction.

Patrick K Johnson
http:\\www.cadenhancement.com
Message 3 of 5
Anonymous
in reply to: Anonymous

Transaction is out this sub. First in other sub I open transaction
and select entity and finaly call this sub.
This code remove record from entity before dispose dict and
transaction. But later, when I check entity for xrecord it exist still.

Thanks!
Message 4 of 5
Anonymous
in reply to: Anonymous

Thanks a lot mr. Patrick K Johnson

I solve problem with your help.

Problem was in commit database, after open transaction I didnot commit
transaction.

Best regards,
Danijel Ivankovic
Message 5 of 5
Anonymous
in reply to: Anonymous

When items appear to working but not showing in the drawing, I always check the transactions first.

Patrick Johnson
http:\\www.cadenhancement.com

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


Autodesk Design & Make Report