I am using the ActiveX control that shipped with MapPoint 2006 in a VB.NET 2005 Windows Forms application. I'm trying to get a recordset containing all the pushpins within the currently displayed portion of the map by plotting out a rectangle that represents the bounds of the map and passing the coordinates to the querypolygon method of the dataset object. The code is below.
Dim locations(5) As MapPoint.Location
locations(0) = objMap.XYToLocation(0, 0)
locations(1) = objMap.XYToLocation(objMap.Width, 0)
locations(2) = objMap.XYToLocation(objMap.Width, objMap.Height)
locations(3) = objMap.XYToLocation(0, objMap.Height)
locations(4) = objMap.XYToLocation(0, 0)
Dim objDataSet As MapPoint.DataSet = objMap.DataSets("My Pushpins")
Dim objRecordset As MapPoint.Recordset = objDataSet.QueryPolygon(locations)
When querypolygon is executed, I get the following message: "The parameter is incorrect." I've looked at a number of examples and played around with the code a bit, but I can't figure out what I'm doing wrong. Anyone have any ideas? Thanks.