Anonymous
01-01-2004, 11:00 AM
Hi,
I just started to test mappoint 2004 in VB.NET and have no experience in vb.net.
I can put the mappointcontrol1 on the windows form , when I try to put code (in the form load event or button click event)
mappointcontrol1.newmap =>still ok
but when I add geoMapEurope this is not working anymore.
( Of course I installed mappoint 2004 europe)
vb.net put a line under geoMapEurope and gives a debug error after starting.
In vb6 it works perfect....
What can I do?
Thanks for help
Wim
NickS
01-02-2004, 11:50 AM
Place a MapPoint control on the form, and then add the following code to the 'Form1_Load':
Try
MappointControl.NewMap(MapPoint.GeoMapRegion.geoMa pEurope)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
(In this example the control on the form is called 'MappointControl'.)
You may want to try adding this code to a button to move to a specified lat/lon...
Dim objmap As MapPoint.Map
Dim objLoc As MapPoint.Location
Dim dblLat, dblLon As Double
dblLat = Val(txtLat.Text) 'Or just put numbers here if no textboxes
dblLon = Val(txtLon.Text)
objmap = MappointControl.ActiveMap
objLoc = objmap.GetLocation(dblLat, dblLon, Val(txtAlt.Text))
objLoc.GoTo()
(This uses three textboxes - txtLat,txtLon, and txtAlt for the lat,lon,and altitude for viewing the map.)
Hope this helps...
Nick
Anonymous
01-02-2004, 03:07 PM
Hi Nick,
Thanks for your help, this way it (NewMap) works!!
I found out that Mappointcontrol.OpenMap("C:\test.ptm") works to if I save first a map.
In the object browser I found that the OpenMap method needs a string as an argument but the NewMap method needs an object.
I think this is the difference with vb6 no?
Best regards,
Wim
NickS
01-02-2004, 04:29 PM
I've only started using MP2004 with VB.Net fairly recently, and looking round the web at sample code, it seems that there are quite a few 'subtle' changes in the syntax between MP2002 and 2004. Just to make it worse, most of the code 'in the wild' is for VB6, which doesn't really help very much!!
You've probably just found your first example!