VB.Net Open KML File (Google API)

This article explains how you can use VB.Net to open a KML File.

Note: The google earth API will only be available if you have Google Earth installed on your computer.

The first step would be to add reference to the Google Earth 1.0 Type Library. Note the version might be different on your computer:
References

The code below can be used to open a KML File:

Module Module1
Sub main()
Dim appGoogleEarth As EARTHLib.ApplicationGE
appGoogleEarth = New EARTHLib.ApplicationGE
Threading.Thread.Sleep(5000)
Call appGoogleEarth.OpenKmlFile( _
"D:StuffBusinessTempUntitled Placemark.kml", 1)
End Sub
End Module

Note: The reason for using the sleep function, is to allow Google Earth to load. If Google Earth has not finished loading and we attempt to open the KML file an error will occur.

Result:
Result

You can download the file and code used in this article from the link below:

Leave a Reply

Your email address will not be published. Required fields are marked *