Hi there,

Many people asked me to create a new tutorial for implementing the Gecko Browser in VB.NET. The old tutorial still works fine, but only with the older versions of the dll. If you want to use that for some reason, visit this link

I created this tutorial presuming that you understand (the basics) how to work with VS.

Enough talk and show me!

1) Download the DLL here: https://bitbucket.org/geckofx/geckofx-14.0/downloads
2) Extract it
3) Download the Xulrunner (14!) here: http://ftp.mozilla.org/pub/mozilla.o...eases/14.0b12/
4) Extract the files

5) Create a new project:

6) Add "Reference" to your project:

7) Reference the "geckofx-core-14.dll" (Copy Local : True)

8) Right-Click your toolbox and add the control "Geckofx-Winforms-14.dll"

9) Select the control from your toolbox

10) Drag the control to your form and resize it (what ever you want to do)

11) Open the Properties of your project and click on "Application" -> "View Application Events"

12) Copy and replace everything with the following code (only if you never used anything in here)

vb.net Code:
  1. Imports Gecko
  2. Imports System.IO
  4. Namespace My
  6.     ' The following events are available for MyApplication:
  7.     '
  8.     ' Startup: Raised when the application starts, before the startup form is created.
  9.     ' Shutdown: Raised after all application forms are closed.  This event is not raised if the application terminates abnormally.
  10.     ' UnhandledException: Raised if the application encounters an unhandled exception.
  11.     ' StartupNextInstance: Raised when launching a single-instance application and the application is already active.
  12.     ' NetworkAvailabilityChanged: Raised when the network connection is connected or disconnected.
  13.     Partial Friend Class MyApplication
  15.         Protected Overrides Function OnStartup(ByVal eventArgs As Microsoft.VisualBasic.ApplicationServices.StartupEventArgs) As Boolean
  17.             '   set the path to the temp files
  18.             Dim ProfileDirectory As String = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) & "\your-appname-companyname-folder\DefaultProfile"
  19.             If Not Directory.Exists(ProfileDirectory) Then
  20.                 Directory.CreateDirectory(ProfileDirectory)
  21.             End If
  23.             '   set the temp-directory for the gecko
  24.             Xpcom.ProfileDirectory = ProfileDirectory
  26.             '   set the path of the directory where the xulrunner files are located
  27.             Dim xrPath As String = System.Reflection.Assembly.GetExecutingAssembly.Location
  28.             xrPath = xrPath.Substring(0, xrPath.LastIndexOf("\") + 1) & "\xulrunner"
  30.             '   initialize the path
  31.             Xpcom.Initialize(xrPath)
  32.             Return True
  33.         End Function
  35.     End Class
  36. End Namespace

13) Drag and Drop the complete "xulrunner" folder to the Solution Explorer.
14) Select every file (not folder) and set the property to: "Copy if newer"

15) copy and paste code in your Form_Load(...)... event

vb.net Code:
  1. GeckoWebBrowser1.Navigate("http://www.x-impress.com")

16) Run the code and voila

Remember that I'm only showing you how to implement it. The rest is up to you. Let me know if something is unclear to you.

Happy coding