my code looks a lot like yours, here:
{code}
Public Function HandletoObjectID(ByVal Hndl As String) As ObjectId
Dim db As Database = acdocs.MdiActiveDocument.Database
Try
Dim ln As Long = Convert.ToInt64(Hndl, 16)
Dim hn As Handle = New Handle(ln)
Dim id As ObjectId = db.GetObjectId(False, hn, 0)
Return id
Catch ex As System.Exception
EdWrite("Error Converting Handle:" & Hndl & vbLf)
Return Nothing
End Try
End Function
{code}
After looking in the object browser, the Handle.Value property is already returning a long, which then you sent .ToString, and re-converted it into long.
Also, you can get the handle from the myBR.Handle, no need to do myBR.ObjectID.Handle.
if you tried one of these:
{code}
String strHand = myBR.Handle.ToString();
long ln = Convert.ToInt64(strHand, 16);
Handle hand = new Handle(ln);
ObjectId id = db.GetObjectId(false, hand, 0);
---OR---
long ln = myBR.Handle.Value
Handle hand = new Handle(ln);
ObjectId id = db.GetObjectId(false, hand, 0);
{code}
you'd probably get the desired results.
FYI, my code is used to get ObjectID's from handles that have been stored as strings in XData, and the only time it ever fails is if the object with that handle has been deleted from the database since the handle was stored.
Dave O.