guohq 发表于 2010-8-6 17:02:00

这个出错应该怎么处理?

Public Function CurveLength(ByVal ID As ObjectId, ByRef Len As Double) As Boolean
      CurveLength = True
      Dim DB As Database = HostApplicationServices.WorkingDatabase
      Using Trans As Transaction = DB.TransactionManager.StartTransaction
            Try
                Dim Ent As Entity = Trans.GetObject(ID, OpenMode.ForRead)
                Dim Cur As Curve = Ent '此处如果不是线,会出错,用了TRY了,为什么不能跳到CATCH 处执行
                Len = Cur.GetDistanceAtParameter(Cur.EndParam)
            Catch ex As Exception
                CurveLength = False
                MsgBox("不正常")
            End Try
      End Using
    End Function

Dim Cur As Curve = Ent '此处如果不是线,会出错,用了TRY了,为什么不能跳到CATCH 处执行

雪山飞狐_lzh 发表于 2010-8-6 19:15:00

If Ent Is Curve Then

guohq 发表于 2010-8-6 20:29:00

谢谢!我想问的是为什么此处出错,不跳到CATCH处执行呢?
页: [1]
查看完整版本: 这个出错应该怎么处理?