BWard
12-17-2005, 09:10 AM
I've only been programming for about 2 years but have done quite a bit of work with another map ocx, however, I can't seem to get started with Mappoint. I am using MP2004 & VB6.
I am looking for someone to give me the 'simplest' example possible of adding a pushpin, based upon lat an lon (using the MappointControl1.control). This will be very much appreciated if I could see how to just only open a form and plot a single location (without all the other partial code snippets involved.
assume lat 26.10000 lon -81.10000
and fill in the form load event..........
Private Sub Form_Load()
End Sub
Wilfried
12-17-2005, 04:03 PM
Hi,
Very simple :)
double lat= 26.10000;
double lon = -81.10000;
Location loc = mp.ActiveMap.GetLocation(lat, lon, 1);
Pushpin pp = mp.ActiveMap.AddPushpin(loc, "");
loc.GoTo();
BWard
12-18-2005, 05:51 AM
Hi,
Very simple :)
double lat= 26.10000;
double lon = -81.10000;
Location loc = mp.ActiveMap.GetLocation(lat, lon, 1);
Pushpin pp = mp.ActiveMap.AddPushpin(loc, "");
loc.GoTo();
Wilfried - Hi. Actually, what I was looking for was just the simplest (standalone) example of what would work, if I was to paste the example in the form load event. Just so that I can see that it works. and how the map control, location and pushpin objects are referenced. The above code looks good and easy to understand, but won't, by itself plot the pushpin.
Example:
Private Sub Form_Load()
...
...
End Sub
Wilfried
12-18-2005, 01:58 PM
Hi,
I'm not sure I understeand your question. I tryed the code in a simple project and it works. So I dont understeand the prolbem. Can uou clarify what you means ?
BWard
12-18-2005, 03:02 PM
Hi,
I'm not sure I understeand your question. I tryed the code in a simple project and it works. So I dont understeand the prolbem. Can uou clarify what you means ?
Yes. I apologize, I didn't explain myself very well the first time. Since I'm using the MapControl< I was hoping to see how someone would reference the map control, loc obj and pp obj properly, etc. so that the above code would run. I thought if I could see everything inside the form load event, I would be able to understand better.
------------------------------------------------------
Private Sub Form_Load()
Mappointcontrol1.NewMap geoMapNorthAmerica
... <--------- ' whatever references are necessary for loc, pp,
... <---------- ' so that the code following with plot a pushpin
double lat= 26.10000;
double lon = -81.10000;
Location loc = mp.ActiveMap.GetLocation(lat, lon, 1);
Pushpin pp = mp.ActiveMap.AddPushpin(loc, "");
loc.GoTo();
End Sub
Wilfried
12-19-2005, 08:35 AM
Hi,
I see. Whell the example I have given mp is the name of my MappointControl. So except loading the map what you already do nothing special to iniitalize. Does this answer your question ?
BWard
12-19-2005, 12:27 PM
Hi,
I see. Whell the example I have given mp is the name of my MappointControl. So except loading the map what you already do nothing special to iniitalize. Does this answer your question ?
:D Got it! Thanks for your patience!
Wilfried
12-19-2005, 02:15 PM
hi,
glad it work for you :)