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

Pushpin programming question

This is a discussion on Pushpin programming question within the MapPoint Desktop Discussion forums, part of the Map Forums category; I've written a small utility that uses MapPoint to import pushpins into a map containing various shapes. I then can ...

  1. #1
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137

    Pushpin programming question

    I've written a small utility that uses MapPoint to import pushpins into a map containing various shapes. I then can report which pushpins are within a shape and which are not.

    The problem I am having is that my MapPoint control already has "My Pushpins" which causes me to write two reports. One is for the data that I've imported and one is for the "My Pushpins" dataset.

    How do I go about deleting the default set?

    If I add the ability to manually enter a location as a pushpin, how do I define which dataset it should go into?

    I'm a relatively new programmer using C#, so I appreciate any help with these bone-head questions.

    Thanks!

    Ken

  2. #2
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    MapPoint always adds new pushpins to the default dataset.
    If you delete the default "MyPushpins" it will be recreated when the next pushpin is added.
    If you rename "MyPushpins" MapPoint will then create "MyPushpins1" as the default dataset when the next pushpin is added.

    The only way seems to be to create a new dataset and move the newly added pushpin to this as below.

    Public Sub AddPushpin( _
    ____ByVal DataSetName As String, _
    ____ByVal objLoc As MapPoint.Location)

    Dim objPin As MapPoint.Pushpin
    Dim DataSetFound As Boolean
    Dim intX As Integer

    'loop through dataset collection
    For intX = 1 To objMap.DataSets.Count
    ____'if dataset name exists
    ____If objMap.DataSets.Item(intX).Name = DataSetName Then
    ________'do not add dataset name
    ________DataSetFound = True
    ________Exit For
    ____End If
    Next intX

    'if dataset name does not already exist
    If Not DataSetFound Then
    ____'add dataset name to dataset collection
    ____objMap.DataSets.AddPushpinSet DataSetName
    End If

    'add pushpin to default dataset
    Set objPin = objMap.AddPushpin(objLoc)

    'move pushpin from default dataset to required dataset
    objPin.MoveTo objMap.DataSets.Item(DataSetName)

    End Sub

    Sorry this is in VB but the general idea is the same.

    Roger

  3. #3
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    Thanks! Maybe I'll use a C# version of this just before running my report to combine all pushpins into one dataset. This way I only get one report instead of one for each dataset.

    Ken

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Ambiguous messages ( programming or not programming? )
    By Mohamed in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 06-13-2006, 04:35 PM
  2. Pushpin set question
    By NoDed in forum MapPoint Desktop Discussion
    Replies: 3
    Last Post: 11-21-2005, 01:34 PM
  3. Lat/Long with Pushpin -- question?
    By onegalacticwino in forum Products: Pushpin Tool, Single State Mapper
    Replies: 2
    Last Post: 10-25-2004, 10:23 AM
  4. Pushpin question from newbie
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 03-24-2004, 12:26 PM
  5. pushpin note question
    By starbuck in forum MapPoint Desktop Discussion
    Replies: 4
    Last Post: 12-03-2003, 05:26 PM

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