3

I am trying to make GeckoWebBrowser (version 45.0.34.0) control to work into my VB.NET project with no luck!!!

Here is the steps I follow...

1. I do right click on my project into Solution Explorer list and then Manage NuGet Packages.

2. I find and install Geckofx45.

3. Then I go into my Project's properties, into Compile tab and I change Target CPU to x86.

4. I Rebuild my project.

5. Then I add GeckoWebBrowser control into my Toolbox by selecting the Geckofx-Winforms.dll file from ...\packages\Geckofx45.45.0.34\lib\net45 folder.

6. I add a GeckoWebBrowser control into my form and just for test, I do GeckoWebBrowser1.Navigate("www.google.com") into my form's Load event.

7. I Start my app and I get nothing!!!

There is any step I miss or something?

8
  • For some reason the community wants to close this question as "too broad". I honestly don't see what would be too broad about it. He explained the exact steps he took and (perhaps a little fuzzy, but still) that the outcome is that nothing's happening. How is that "too broad"? Commented Mar 22, 2018 at 9:16
  • 1
    I took a peek at the GeckoFX wiki and saw that they were calling Xpcom.Initialize("Firefox") prior to initializing the web browser. What happens if you put this before navigating in the Form.Load event? If it still doesn't work, also try removing the web browser from the form and create it through code after the Xpcom call. Commented Mar 22, 2018 at 9:23
  • I found the solution my friend Vincent!!! Now I am writing the solution in steps, for those who want to use GeckoWebBrowser in VB.NET. :) Commented Mar 22, 2018 at 9:23
  • @VisualVincent: Please don't close this question my friend, I am coming with an answer!!! Commented Mar 22, 2018 at 9:24
  • I am not the one wanting to close it, but others are... Commented Mar 22, 2018 at 9:32

1 Answer 1

7

After an exhausting(!!!) research over the internet, I managed to make it work!!! Here is the steps for anyone who want to use GeckoWebBrowser to his/her VB.NET project.

1. Create a new VB.NET project or just open an existing one.

2. Go to menu Project and click on Manage NuGet Packages.

3. Click on Browse tab and search for Geckofx45.

4. Choose the one with description: library that allows embeding gecko in C# applications and click Install button.

5. Close NuGet window and go to your project's Properties.

6. Into Application tab click the View Application Events button.

7. Delete everything in there and paste this part of code and save it.

Imports Gecko
Imports System.IO
Namespace My
    ' The following events are available for MyApplication:
    '
    ' Startup: Raised when the application starts, before the startup form is created.
    ' Shutdown: Raised after all application forms are closed.  This event is not raised if the application terminates abnormally.
    ' UnhandledException: Raised if the application encounters an unhandled exception.
    ' StartupNextInstance: Raised when launching a single-instance application and the application is already active.
    ' NetworkAvailabilityChanged: Raised when the network connection is connected or disconnected.
    Partial Friend Class MyApplication
        Protected Overrides Function OnStartup(ByVal eventArgs As Microsoft.VisualBasic.ApplicationServices.StartupEventArgs) As Boolean
            Dim ProfileDirectory As String = My.Application.Info.DirectoryPath & "\Firefox\Profile"
            If Not Directory.Exists(ProfileDirectory) Then
                Directory.CreateDirectory(ProfileDirectory)
            End If
            Xpcom.ProfileDirectory = ProfileDirectory
            Gecko.Xpcom.Initialize("Firefox")
            Return True
        End Function
    End Class
End Namespace

8. Now, go back to your project Properties, click on Compile tab and set the Target CPU value to x86.

9. Build or Rebuild your project.

10a. To add GeckoWebBrowser control into your Toolbox, first create a new Tab by then name GeckoFX 45 or whatever you like.

10b. Right click on it and click on Choose Items.

10b. Go into .NET Framework Componetns and click Browse button.

10c. Find Geckofx-Winforms.dll into your-project-folder\packages\Geckofx45.45.0.34\lib\net45\ and click Open button.

10d. Make sure that GeckoWebBrowser is checked and then click OK.

Sign up to request clarification or add additional context in comments.

13 Comments

Glad you found a solution! :)
Now I am trying to see if I can make it work for x64 too and I'll update my answer!!!
Hi. i have problem with adding in to the Toolbar. Always giving me an error ,,There are no components...". Maybe can you suggest a solution? Thanks
@RobertNegreanu: That means you stuck on step 10a ?
Stuck on 10c :) Maybe I will try with an older version
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.