Listing 1


'create instance of render service
Public myRenderService As New MPNet.RenderServiceSoap()

'define data source and location
Public myDataSourceName As String = "MapPoint.NA"
Public myCountryRegion As String = "United States"

'instantiate a method of the render service and define the distance unit
myRenderService.UserInfoRenderHeaderValue = New UserInfoRenderHeader()
myRenderService.UserInfoRenderHeaderValue.DefaultDistanceUnit = DistanceUnit.Mile

'define MapPoint Web Service credentials and set credentials property with these
 variables
Dim uid As String = "1234"
Dim pw As String = "******"
myRenderService.Credentials = New NetworkCredential(uid, pw)

'after defining a map view, define default initial location (lat/long) for center
 of the map
myViews(0).CenterPoint.Latitude = 39.741086
myViews(0).CenterPoint.Longitude = -104.9842

'create an instance of the MapSpecification to define map features
Dim mapSpec As New MPNet.MapSpecification
mapSpec.DataSourceName = myDataSourceName

'Make the call to the MapPoint .NET service and display the resulting map in the
 picturebox
Dim mapImages() As MPNet.MapImage
mapImages = myRenderService.GetMap(mapSpec)
pbMap.Image = New Bitmap(New System.IO.MemoryStream(mapImages(0).MimeData.Bits))