Welcome to MapForums!

Register, sign in, or use Facebook Connect above to join in and participate in the forum.

When you are signed in, this message, the ads in this row, and the red-underlined link ads all go away.

Subscribe to receive our newsletter.
Subscribe Unsubscribe
Results 1 to 3 of 3

QueryPolygon Error

This is a discussion on QueryPolygon Error within the Development forums, part of the MapPoint Desktop Discussion category; Hi. I am using the ActiveX control that shipped with MapPoint 2006 in a VB.NET 2005 Windows Forms application. I'm ...

  1. #1
    dfriebus is offline Junior Member White Belt
    Join Date
    Dec 2007
    Posts
    3

    QueryPolygon Error

    Hi.

    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.

  2. #2
    Paul Larson is offline Senior Member Green Belt
    Join Date
    Sep 2005
    Location
    Battle Creek, Michigan
    Posts
    136

    Wink Re: QueryPolygon Error

    It's a simple problem: Your array of Locations is dimensioned too large.
    Instead use

    Dim locations(4) As MapPoint.Location

    In VB.Net, the zero-base is assumed, so you were actually creating a 6-item array, the last of which was not initialized.

    HTH
    -Paul

  3. #3
    dfriebus is offline Junior Member White Belt
    Join Date
    Dec 2007
    Posts
    3

    Re: QueryPolygon Error

    Completely missed it. Thanks, Paul!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. On Error Help - VBA
    By andriy in forum Development
    Replies: 7
    Last Post: 10-09-2007, 11:56 AM
  2. Run-time error 2147467259 80004005 automation error
    By ThomasB in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 02-27-2007, 12:41 PM
  3. About ERROR 4-40028-1. Error or Bug ?
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 12
    Last Post: 01-11-2005, 10:32 AM
  4. I get this following error
    By ananthdeena in forum MapPoint Desktop Discussion
    Replies: 3
    Last Post: 01-01-2005, 03:46 AM
  5. vb to c# error question
    By starbuck in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 09-13-2004, 10:40 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96