With a little time off for the holidays I was able to find time to work on this for a few days, with help from Fixo, Bert and through-the-interface I was able to get a working sample for now. currently working on test for button that cycles thru each row and does the same function as the right click but it needs a check for empty row value and highlight current row as visual for user.
thanks to all for sample & help
john
Private Sub DataGridView2_MouseDown(sender As System.Object, e As System.Windows.Forms.MouseEventArgs) Handles DataGridView2.MouseDown
Dim ed As Editor = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor()
Dim db As Database = HostApplicationServices.WorkingDatabase
Dim civilDoc As CivilDocument = CivilApplication.ActiveDocument
Dim acaddoc As Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument
If e.Button = Forms.MouseButtons.Right Then
Dim hi As DataGridView.HitTestInfo = Me.DataGridView2.HitTest(e.Location.X, e.Location.Y)
MsgBox(Me.DataGridView2(6, hi.RowIndex).Value.ToString() + vbLf + Me.DataGridView2(7, hi.RowIndex).Value.ToString())
Dim passcell6 As Double
Dim passcell7 As Double
passcell6 = (Me.DataGridView2(6, hi.RowIndex).Value.ToString())
passcell7 = (Me.DataGridView2(7, hi.RowIndex).Value.ToString())
Dim zoomcorner1(0 To 1) As Double
Dim zoomcorner2(0 To 1) As Double
zoomcorner1(0) = passcell6 + 100
zoomcorner1(1) = passcell7 + 100
zoomcorner2(0) = passcell6 - 100
zoomcorner2(1) = passcell7 - 100
'x,y, location from grid
Dim _pMin As Autodesk.AutoCAD.Geometry.Point2d = New Autodesk.AutoCAD.Geometry.Point2d(zoomcorner1)
Dim _pMax As Autodesk.AutoCAD.Geometry.Point2d = New Autodesk.AutoCAD.Geometry.Point2d(zoomcorner2)
Dim Min As Point2d
Dim Max As Point2d
Min = _pMin
Max = _pMax
ZoomWin(ed, Min, Max, True)
End If
End Sub
Private Shared Sub ZoomWin(ByVal ed As Editor, ByVal Min As Point2d, ByVal Max As Point2d, ByVal quietly As Boolean)
Dim lower As String = Min.ToString.Substring(1, (Min.ToString.Length - 2))
Dim upper As String = Max.ToString.Substring(1, (Max.ToString.Length - 2))
Dim cmd As String = ("_.ZOOM _W " _
+ (lower + (" " _
+ (upper + " "))))
If quietly Then
' Get the old value of NOMUTT
Dim nomutt As Object = Autodesk.AutoCAD.ApplicationServices.Application.GetSystemVariable("NOMUTT")
' Add the string to reset NOMUTT afterwards
cmd = (cmd + ("_NOMUTT " _
+ (nomutt.ToString + " ")))
' Set NOMUTT to 1, reducing cmd-line noise
Autodesk.AutoCAD.ApplicationServices.Application.SetSystemVariable("NOMUTT", 1)
End If
' Send the command(s)
ed.Document.SendStringToExecute(cmd, True, False, Not quietly)
End Sub