Message 1 of 6

Not applicable
08-11-2010
09:12 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi All,
I saved a object handle in listview item tag
lvItem.tag=objFixture.Handle.ToString
later on I pass this handle to another function
Private Sub func(ByVal strHandle As String, ByVal strError As String) Dim ed As Editor = acApp.DocumentManager.MdiActiveDocument.Editor Dim trans As Transaction = acApp.DocumentManager.MdiActiveDocument.Database.TransactionManager.StartTransaction Dim db As Database = acApp.DocumentManager.MdiActiveDocument.Database Try Dim objID As ObjectId = db.GetObjectId(False, New Handle(Convert.ToInt64(strHandle, 16)), 0) Dim objFixture As BlockReference = trans.GetObject(objID, OpenMode.ForWrite) ' Here will throw error Dim rbOld As ResultBuffer = objFixture.GetXDataForApplication(STR_XDATA_FIXTURE) Dim tvOld() As TypedValue = rbOld.AsArray .... ..... Dim rbNew As New ResultBuffer(tvOld) objFixture.XData = rbNew rbNew.Dispose() trans.Commit() Catch ex As Exception ' strError = ex.Message.ToString trans.Abort() Finally trans.Dispose() End Try End Sub
Calling part is
Func(lvItem.Tag.ToString, strError)
Basically I would like to get a blockreference based on the handle then get/set its xdata
Any ideas?
This question may obvious to you guys, as I am new to .Net AutoCAD
Thanks
Solved! Go to Solution.