David,
I think this sample I posted might help?
Orignal post:
http://www.mp2kmag.com/mappoint/disc...pic.asp?t=3327 Quote:
|
Give this a try, I think it will do what your asking. I'm just counting the number of pushpins in the selected area (the rectangle made when holding the left mouse button and dragging) but you could get there name/location or whatever you need.. BTW, If you did not select an area it will just exit sub.
|
Code:
Private Sub Command1_Click()
On Error GoTo error:
Dim objmap As MapPointctl.Map
Set objmap = MappointControl1.ActiveMap
Dim sa As MapPointctl.SelectedArea
Set sa = objmap.SelectedArea
Dim objDataSet As MapPointctl.DataSet
Dim objRecords As MapPointctl.Recordset
Dim objLocs(1 To 5) As MapPoint.Location
Set objLocs(1) = objmap.XYToLocation(sa.Left, sa.Top)
Set objLocs(2) = objmap.XYToLocation(sa.Left + sa.Width, sa.Top)
Set objLocs(3) = objmap.XYToLocation(sa.Left + sa.Width, sa.Top + sa.Height)
Set objLocs(4) = objmap.XYToLocation(sa.Left, sa.Top + sa.Height)
Set objLocs(5) = objmap.XYToLocation(sa.Left, sa.Top)
'Remove the comment from the next line to see the polygon being queried
'objmap.Shapes.AddPolyline objLocs
lngCount = 0
For Each objDataSet In objmap.DataSets
Set objRecords = objDataSet.QueryPolygon(objLocs)
objRecords.MoveFirst
Do While Not objRecords.EOF
lngCount = lngCount + 1
objRecords.MoveNext
Loop
Next
MsgBox "Number of records in polygon: " & lngCount
Exit Sub
error:
MsgBox Err.Description
End Sub