• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 180
  • Last Modified:

united states map reporting

my boss has asked me to create a report with a map of the united states as shown at this web address http://www.yourchildlearns.com/us_map.htm.  what he wants is to show a dot in a state that has a contact record and next to the dot show the contact name from the database.
does any one have a way to do this??  

1 Solution
So you just want to display this information?

You can put this image into a picturebox, and store the coordinates for each state... then want you want to display the contact, you can draw a dot on a picturebox on a state's coordinates... then create a new label (create lable array first), fill it with data and move it to same coordinates... just ask if you need more specific help...

Hey, man,
Be aware  that most of the world is outside the US.
First of all, are you working with the website, or just a map that looks like that?
If the latter than you could prepare a map with precise colours for each state and let the point(x,y) value determine the chosen area. If you are forced to have the same colour value for different areas, then you must map the distinction in code:

Function StatetSelected(x a single. y as single) as integer

Select Point(x,y)
      Case vbRed
             If x > 100 and x < 300 and y > 500 and y < 600 then
                   StatetSelected= MyConstWyoming
                   StatetSelected= MyConstFlorida
             end if


David LeeCommented:
You mentioned a report.  What kind of report?  If you mean a printed report, then I'd think Visual Basic isn't the best way to go.  If you mean something interactive like the web page with the map, then you could modify the Javascript routine that map pages uses to display the capitals.
naftyAuthor Commented:
DarkoLord, i like your suggestion can you give me a little more to get started with

Create a picturebox (set its AutoRedraw property to True) and load your map into it... then use this function to get the coordinates of the point you want your dot to be displayed on...

Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
   Debug.Print X, Y
End Sub

So when you click on each state (capital city or whatever..) you will get coordinates of that point...
Then store this coordinates in a array or something... Then create a label ON a picturebox and set it's Index property to 0 and Visible to false...
use this function to draw a dot on specified coordinates and show a new label there:

Private Sub Command1_Click()
    Picture1.DrawWidth = 10 'dot diameter
    Picture1.Line (945, 945)-(945, 945) 'change with your x and y
    Load Label1(Label1.Ubound + 1)
    Label1(Label1.Ubound).Move 995, 995 'move a label a little bit down and right so it's not on top of the dot...
    Label1(Label1.Ubound).Caption = "Howdie"
    Label1(Label1.Ubound).Visible = True
End Sub

So basically what you just need to do is to look up the coordinates of the state (from array or table) and then change the caption of a label...

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now