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 7 of 7

How to list the name of all group of pushpins ?

This is a discussion on How to list the name of all group of pushpins ? within the MapPoint Desktop Discussion forums, part of the Map Forums category; Hello I developp an add-in for MapPoint 2004 in C sharp and I want to list all the pushpin's name ...

  1. #1
    Elbarto is offline Junior Member Yellow Belt
    Join Date
    Mar 2006
    Posts
    13

    How to list the name of all group of pushpins ?

    Hello

    I developp an add-in for MapPoint 2004 in C sharp and I want to list all the pushpin's name that are in the map

    for example I load an excel file that have 5 groups of pushpins and I want to enumerate all of them in a listbox, how can I do this ?

    whith this code I can only access to the first pushpin, but not the others:

    object o = 1;


    MapPoint.DataSet ds = app.ActiveMap.DataSets.get_Item(ref o);
    MapPoint.Recordset rs = ds.QueryAllRecords();
    rs.MoveFirst();
    while (!rs.EOF)
    {
    MapPoint.Location loc = rs.Pushpin.Location;
    MessageBox.Show(loc.Name);
    rs.MoveNext();
    }
    thanks

  2. #2
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433
    Hi,

    I just tryed exacly the same (check my code eventually), and it display's all pushpins currently on the map:

    Code:
        object o = 1;
        MapPoint.DataSet ds = mp.ActiveMap.DataSets.get_Item(ref o);
        Recordset rs = ds.QueryAllRecords();
        rs.MoveFirst();
        while (!rs.EOF) {
            Location loc = rs.Pushpin.Location;
            Console.WriteLine(rs.Pushpin.Name.ToString());
            Console.WriteLine(loc.Name); // both are the same
            rs.MoveNext();
        }
    Showing a messagebox non modal should give the same result.

  3. #3
    Elbarto is offline Junior Member Yellow Belt
    Join Date
    Mar 2006
    Posts
    13
    But this code doesn't show all of the group of pushpin ( "clicks-infos" in my french version of MapPoint ), it show only the first group of "click info"

    for example you can see in this screenshot 7 "clicks-infos" ( group of pushpin ) :



    the source code in my first message shows only the first "click info" ( pushpin AGF in the screenshot ),

    But I want to list all of the pusphin in the map ( the 7 "clicks infos" )

    do you have an idea to do this ?

    thanks

  4. #4
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433
    Hi,

    I hope I understeand all now
    I think they are in different datasets. So you have to parse trough all datasets. Something like this should work. I did test it, but did not checked it with several datasets:

    Code:
                MapPoint.DataSets dataSets = mp.ActiveMap.DataSets;
                foreach (MapPoint.DataSet ds in dataSets) {
                    Recordset rs = ds.QueryAllRecords();
                    rs.MoveFirst();
                    while (!rs.EOF) {
                        Location loc = rs.Pushpin.Location;
                        Console.WriteLine(loc.Name);
                        rs.MoveNext();
                    }
                }

  5. #5
    Elbarto is offline Junior Member Yellow Belt
    Join Date
    Mar 2006
    Posts
    13
    Thanks it's ok

    but now I want to retrieve adress, postalcode and city from the pushpin,

    I use this code:

    string sParamPushpin;

    //street name
    sParamPushpin+=loc.StreetAddress.Street + ";";

    //postalcode
    sParamPushpin+=loc.StreetAddress.PostalCode +";";

    //City
    sParamPushpin+=loc.StreetAddress.City + ";";

    //Country
    sParamPushpin+=loc.StreetAddress.Country;
    but this code doesn't work for some pushpin, for example for "postalcode" the value is incorrect ( 00014 instead of 44000 ), I don't understand

    what is the correct syntax for retrieving the street adress, postalcode and city from a pushpin ?

  6. #6
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433
    Hi,

    You do the correct code. But I recall other post that sometime the postcode is not the right one. Also you can get (I think) incorrect results if your pushpin is not on a known street.

  7. #7
    Elbarto is offline Junior Member Yellow Belt
    Join Date
    Mar 2006
    Posts
    13
    It's very strange, because when I export the data to Excel ( with a right click on the "clic-info" in the screenshot ) then I can see the correct adress in the excel file

    theses pushpins in my example come from an import data process ( file TXT or excel file )

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Block group geographies
    By bcimapr in forum Wish List
    Replies: 1
    Last Post: 12-01-2004, 02:05 PM
  2. Printing a corresponding list of addresses from pushpins
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 10-26-2004, 02:54 PM
  3. Finding the center of a group of pushpins
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 3
    Last Post: 04-07-2004, 04:51 PM
  4. Select pushpins list
    By tanguy_laverdure in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 02-20-2004, 09:59 AM
  5. Is it possible to group several pushpins together,....
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 08-27-2001, 01:03 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 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