Click here to Skip to main content
14,695,085 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am working on a VB.NET project and using the GeckoWebBrowser control (v45.0.34.0), I am trying to download a file from a web page on html button click. I managed to load the page, find the button, but when my code "clicks" on it, I get nothing!!! Do I have to create any "extra" event for this? Isn't it work like Visual Studio's WebBrowser control? Also, I can't find tutorials online about GeckoWebBrowser!!! If you have any links I would be really thankful...

PS: It's OK if you have any example on C#, I can convert it.

What I have tried:

Imports Gecko

Public Class Form1
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    End Sub

    Private Sub GeckoWebBrowser1_DocumentCompleted(sender As Object, e As Events.GeckoDocumentCompletedEventArgs) Handles GeckoWebBrowser1.DocumentCompleted

        Dim _Elements As GeckoElementCollection = GeckoWebBrowser1.Document.GetElementsByTagName("input")
        For Each _Element As GeckoHtmlElement In _Elements
            Dim _value As String = _Element.GetAttribute("value")
            If _value IsNot Nothing AndAlso _value <> "" AndAlso _value.Contains("Download") Then
            End If
    End Sub
End Class
Updated 23-Jul-20 11:21am
Member 13981933 24-Sep-18 13:33pm
I have also exactly the same problem. Have you found any solution??

1 solution

Try this (in C#)

LauncherDialog.Download += new EventHandler<LauncherDialogEvent>(LauncherDialog_Download);

private void LauncherDialog_Download(object sender, LauncherDialogEvent e)
    var saveFileDialog1 = new SaveFileDialog();

    saveFileDialog1.Filter = "All files (*.*)|*.*";
    saveFileDialog1.FilterIndex = 2;
    saveFileDialog1.RestoreDirectory = true;
    saveFileDialog1.FileName = e.Filename;

    if (saveFileDialog1.ShowDialog() == DialogResult.OK)
        nsILocalFile objTarget = Xpcom.CreateInstance<nsILocalFile>(";1");
        using (nsAString tmp = new nsAString(saveFileDialog1.FileName))
        e.HelperAppLauncher.SaveToDisk(objTarget, false);

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900