Imports GMap.NET
Imports GMap.NET.MapProviders
Public Class Form1
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Try
GMapProvider.WebProxy = Net.WebRequest.DefaultWebProxy
GMapProvider.WebProxy.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials
If My.Computer.Network.Ping("www.google.com", 1000) = True Then
GMap.Manager.Mode = AccessMode.ServerAndCache
GMap.MapProvider = MapProviders.GoogleMapProvider.Instance
With Me.GMap
.Position = New GMap.NET.PointLatLng(51.51, -0.14)
.ZoomAndCenterMarkers(CType(vbNull, String))
.Zoom = 10
End With
GMap.Refresh()
Else
MessageBox.Show(
"There is no Internet Connection. " & vbNewLine & _
"This is needed to load the Maps from Google. Please connect to the Network!", _
"Error loading Map Data!", MessageBoxButtons.OK)
Exit Try
End If
Catch ex As Exception
MessageBox.Show(ex.Message, "Error loading data!", MessageBoxButtons.OK)
End Try
End Sub
End Class