Solved

united states map reporting

Posted on 2004-09-02
5
168 Views
Last Modified: 2010-05-02
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??  

thanks
0
Comment
Question by:nafty
5 Comments
 
LVL 22

Expert Comment

by:DarkoLord
Comment Utility
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...

Darko
0
 
LVL 76

Expert Comment

by:GrahamSkan
Comment Utility
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
             Else
                   StatetSelected= MyConstFlorida
             end if

etc

           
0
 
LVL 76

Expert Comment

by:David Lee
Comment Utility
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.
0
 

Author Comment

by:nafty
Comment Utility
DarkoLord, i like your suggestion can you give me a little more to get started with
0
 
LVL 22

Accepted Solution

by:
DarkoLord earned 500 total points
Comment Utility
Sure...

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

Darko
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now