with option strict on I have to do different than i would have done in vb6
you used to do a GetEntity passing an acadentity object to the byref arg
then check If typeof oEnt Is AcadLine (or whatever your target entity type was)
now, with option strict on I have to pass an Object type to GetEntity(not an AcadEntity), when I read the TypeOf after selection it isn't the acadtype because it's been cast to Object type
so now it seems you just cast to the acadtype you want in a try block and let the exception catch the error rather than checking TypeOf...is that correct?
example
in past i would have done:
Try
m_acadDoc.Utility.GetEntity(DirectCast(oEnt, Object), vp, "Pick End 1")
Catch ex As ApplicationException
m_Util.Logentry("Error " & ex.Message)
End Try
If TypeOf oEnt Is AcadLine Then
m_oEnd1 = DirectCast(oEnt, AcadLine)
Else
MsgBox("Not a line")
Exit Try
End If
but that says oent is not a Line even if it was because it was cast to object(i'm guessing that's the reason)
so now is it correct to just do:
Try
m_acadDoc.Utility.GetEntity(DirectCast(oEnt, Object), vp, "Pick End 1")
m_oEnd1 = DirectCast(oEnt, AcadLine)
Catch ex As ApplicationException
m_Util.Logentry("Error " & ex.Message)
End Try
that way it either errors if nothing was picked or if the cast to acadLine fails so i dont' know which necessarily...
is that a clear question?
thanks
mark