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

Selecting Shape Based on Name

This is a discussion on Selecting Shape Based on Name within the MapPoint Desktop Discussion forums, part of the Map Forums category; I have some code where I want to select a shape based on its name Dim objShape As MapPoint.Shape Dim ...

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

    Selecting Shape Based on Name

    I have some code where I want to select a shape based on its name

    Dim objShape As MapPoint.Shape
    Dim strName As String

    strName = "NA123456"

    objShape = objMap.Shapes.Item(strName)

    Basically something like that, however everytime I run it I get the rather irratating Mappoint has encountered a problem and needs to close window.

    If I do

    objShape = objMap.Shapes.Item(1)

    It works fine

    The help files clearly state that you can select a shape based on its name, and all the shapes have been named properly.

    Has anyone else encountered a similar problem or has any ideas as to what i'm doing wrong

  2. #2
    John Meyer's Avatar
    John Meyer is offline Senior Member Blue Belt
    Join Date
    Jul 2002
    Posts
    478
    Not all shapes have a name property (like a geoline for example). Here is a basic sample that might help. Create a shape (Rectangle,Oval or Circle) and name it "MyShape"

    Code:
    Dim objshape As MapPoint.Shape
        For Each objshape In MappointControl1.ActiveMap.Shapes
            
            Select Case objshape.Type
                Case 1 ' An AutoShapeType (Rectangle,Oval or Circle)
                    If objshape.Name = "MyShape" Then
                        MsgBox "Do Something"
                    End If
            End Select
        Next

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Does an object reside in my Shape or Shape boundaries?
    By hotrdd in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 08-04-2005, 10:51 PM
  2. Selecting and deleting the push pin
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 02-10-2005, 08:01 AM
  3. Selecting cities in drivetime
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 5
    Last Post: 02-02-2005, 05:21 PM
  4. Selecting a prviously drawn shape
    By CSG in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 03-24-2004, 11:08 AM
  5. Selecting pushpins within a shape
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 09-26-2002, 09:11 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