Hi Guys,
 
Thanks for replying!!
 
I saw Kean's code for grab(). I used a c# to vb translator and managed to get it to work.
 
So I managed to select objects
Get a startpoint
fix the selection to Grab()
and get a endpoint from grab()
I added Yuan's rubber line(brilliant!!) to my code and was very proud it all worked. (I started with vb.net a week ago and had only a little autolisp an vba experience. I was going very nice, up to now)
 
But now I'm putting it all together and I get a unhandled exception error. What's wrong with my code?
I realize the code below is very dirty since i have to get used to the VB syntax, forgive me.
 
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.EditorInput
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.Runtime Imports Autodesk.AutoCAD.Geometry
Imports Autodesk.AutoCAD.GraphicsInterface
 
Public Class dragtest
    <CommandMethod("dt")> _
    Public Sub DragTest()
 
        Dim doc As Document = Application.DocumentManager.MdiActiveDocument
        Dim db As Database = doc.Database
        Dim ed As Editor = doc.Editor
 
        Using tr As Transaction = db.TransactionManager.StartTransaction()
 
            Dim ssSet As PromptSelectionResult = ed.GetSelection()
 
            ' startpoint
            Dim prPointRes As PromptPointResult
            prPointRes = ed.GetPoint("Select a Start Point: ")
            Dim PointSP As Point3d = New Point3d(prPointRes.Value.ToArray)
 
 
            '' Open the Block table for read
            Dim bt As BlockTable
            bt = tr.GetObject(db.BlockTableId, OpenMode.ForRead)
 
            '' Open the Block table record Model space for write
            Dim ms As BlockTableRecord
            ms = tr.GetObject(bt(BlockTableRecord.ModelSpace), OpenMode.ForWrite)
 
            Dim rLine As Line = Nothing
 
            Dim ppr As PromptPointResult = ed.Drag(ssSet.Value, vbLf & "Select text location: ", _
                                                   Function(pt As Point3d, ByRef mat As Matrix3d)
 
                                                       If PointSP = pt Then
 
                                                           Return SamplerStatus.NoChange
 
                                                       Else
 
                                                           If rLine = Nothing Then
 
                                                               rLine = New Line(PointSP, pt)
rLine.SetDatabaseDefaults(db)
 
                                                               Dim intCol As IntegerCollection = New IntegerCollection
 
 
TransientManager.CurrentTransientManager.AddTransient(rLine,
TransientDrawingMode.DirectShortTerm, 128, intCol)
 
                                                           Else
 
 
rLine.EndPoint = pt
                                                               Dim intCol As IntegerCollection = New IntegerCollection 
 
 
TransientManager.CurrentTransientManager.UpdateTransient(rLine, intCol)
 
                                                           End If
 
                                                           mat = Matrix3d.Displacement(PointSP.GetVectorTo(pt))
 
                                                       End If
 
                                                       Return SamplerStatus.OK
 
                                                   End Function)
 
 
 
            If ppr.Status = PromptStatus.OK Then
 
                ' Check rLine
 
                If rLine <> Nothing Then
 
                    Dim intCol As IntegerCollection = New IntegerCollection
 
 
TransientManager.CurrentTransientManager.EraseTransient(rLine, intCol)
 
                    rLine.Dispose()
                    rLine = Nothing
 
                End If
 
                ' Get the final translation
 
                Dim acPt3d As Point3d = PointSP
                Dim acVec3d As Vector3d = acPt3d.GetVectorTo(ppr.Value)
 
                For Each acSSObj As SelectedObject In ssSet.Value
 
                    If Not IsDBNull(acSSObj) Then
 
                        Dim acEnt As Entity = tr.GetObject(acSSObj.ObjectId, OpenMode.ForWrite)
                        acEnt.TransformBy(Matrix3d.Displacement(acVec3d))
 
                    End If
                Next
 
                tr.Commit()
 
            End If
 
        End Using
 
    End Sub
 
 
End Class
 
I attached also my VB file.
 
Please help. Thanks!!
 
Jeroen