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

Locating pushpin with partial name

This is a discussion on Locating pushpin with partial name within the MapPoint Desktop Discussion forums, part of the Map Forums category; I have a set of pushpins in a map which each have a name that follows the format " a ...

  1. #1
    Dazzer is offline Senior Member Green Belt
    Join Date
    Sep 2003
    Posts
    103

    Locating pushpin with partial name

    I have a set of pushpins in a map which each have a name that follows the format "a number & some text"

    In my vb application then have a list of all pushpins in a listbox, the list box contains the number part of the pushpin name.

    what i would like to happen is when the user selects a number from the listbox the appropriate pushpin is then selected in mappoint

    I have the following code

    Dim objPin As MapPoint.Pushpin
    Dim objMap As MapPoint.Map
    Dim gappmp as Mappoint.application

    Set objMap = gappmp.ActiveMap

    Set objPin = objMap.FindPushpin(Me!listbox)
    objPin.Select


    Where Me!listbox is the listbox on my vb form. However as the listbox only contains the number part of the pushpin name (and this is all it will ever hold, i don't wish to change this) it can't find the pushpin as it is clearly looking for the whole name.

    I would like to know is it possible to find a pushpin based only on part of the name, instead of the whole name.

    I would be very grateful for any help.

    Dazzer

  2. #2
    Matrices is offline Member Yellow Belt
    Join Date
    Sep 2003
    Posts
    44
    how about :

    Code:
    Set objPin = objMap.FindPushpin("other_text" & Me!listbox)
    M

  3. #3
    Dazzer is offline Senior Member Green Belt
    Join Date
    Sep 2003
    Posts
    103
    That would work however I really need it to find the pushpin based purely on the number in the list box

    For example if I have a pin with the name "23 MrANOther"

    And the listbox (or combo box I have yet to decide) contains the values
    1
    12
    23
    34
    54

    When the user selects 23 I would then like the pin that contans 23 to be selected.

    The problem really occured when the map was set up (not by me) each pin should have contained the number in the name field and nothing else, the text should have then gone in the notes. As there are about 200 pins I don't really have the time to go through each one and correct this.

    Is there something like * which might work
    e.g.
    Code:
    Set objPin = objMap.FindPushpin(Me!listbox & "*")
    This doesn't apear to work but is there something I can do along these lines.

    Or perhaps there is something I can do with FindResults or though i have no idea what? Lets face it, I think i'm going to have to go through each pin and rename them aren't I?

  4. #4
    Matrices is offline Member Yellow Belt
    Join Date
    Sep 2003
    Posts
    44
    Not too sure then tbh, i'm not too hot with excel, but if you export all your pins to excel, maybe you can find a quick way of separating the numbers from the text then re-import the data into mappoint

    M

  5. #5
    John Meyer's Avatar
    John Meyer is offline Senior Member Blue Belt
    Join Date
    Jul 2002
    Posts
    478
    As far as I know you can not use a partial string match with the find pushpin method.

    You could loop thru your pushpins and do a instr.

    Code:
    Dim objmap As MapPointCtl.Map
    Set objmap = MappointControl1.ActiveMap
    Dim objDataSet As MapPointCtl.DataSet
    Dim objRecords As MapPointCtl.Recordset
    
    
    Set objDataSet = objmap.DataSets("My Pushpins")
    Set objRecordset = objDataSet.QueryAllRecords
    
    Do While Not objRecordset.EOF
     If InStr(1, objRecordset.Pushpin.Name, "test", vbTextCompare) Then
        MsgBox objRecordset.Pushpin.Name
     End If
    objRecordset.MoveNext
    Loop

  6. #6
    Dazzer is offline Senior Member Green Belt
    Join Date
    Sep 2003
    Posts
    103
    Thanks that done the job, saved me a hell of a lot of work too!!

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Find fails with full install but not partial
    By Tony Kobine in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 08-19-2005, 04:50 AM
  2. Street names: partial matching
    By apravettoni in forum MapPoint Desktop Discussion
    Replies: 6
    Last Post: 06-22-2005, 03:56 PM
  3. Locating the name of a Shape selected
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 4
    Last Post: 04-30-2004, 05:57 AM
  4. Pl.. Help ----Locating/ placing positions in India
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 11-13-2003, 03:20 AM
  5. Can you pinpoint with a partial postcode?
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 10-03-2002, 03:13 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