title: Cefsharp download window for showing progress in VB.Net
body: <p>I am creating a browser using Cefsharp in VB.Net, and I have been trying to create a download window that shows the progress of the current download. I don't know if I am doing something wrong or if it is the way CEF works, but I put in a download handler by adding <code>browser.DownloadHandler = New DownloadHandler</code> to <code>Form1_Load</code> and creating a new class like this (with <code>downloading</code> being the form I created for showing the progress):</p>
  
  <pre><code>Public Class DownloadHandler
  Implements IDownloadHandler
  Public Function OnBeforeDownload(downloadItem As DownloadItem, ByRef downloadPath As String, ByRef showDialog As Boolean) As Boolean Implements IDownloadHandler.OnBeforeDownload
      downloadPath = downloadItem.SuggestedFileName
      showDialog = True
      downloading.Show()
  
      Return True
  End Function
  
  Public Function OnDownloadUpdated1(downloadItem As DownloadItem) As Boolean Implements IDownloadHandler.OnDownloadUpdated
      My.Settings.downloadpercent = downloadItem.PercentComplete.ToString
  
      Return False
  End Function 
  End Class
  </code></pre>
  
  <p>On the <code>downloading</code> form I have this code for showing the progress: </p>
  
  <pre><code>Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
      Dim percentcomplete As Integer = My.Settings.downloadpercent * 5
      Me.PictureBox1.Size = New Size(percentcomplete, 25)
  End Sub
  
  Private Sub downloading_Load(sender As Object, e As EventArgs) Handles MyBase.Load
      Timer1.Start()
  End Sub
  </code></pre>
  
  <p>This may not be the best way to show a <code>ProgressBar</code>, but I have a picture box that just has a green bar, and the total width of the form is 500px. The code is telling it to read the <code>PercentComplete</code> setting put in <code>My.Settings.downloadpercent</code>, multiply it by 5, so when the progress in 100%, it will go across the whole form.</p>
  
  <p>The problem is that the ProgressBar is not being updated to show the current progress. It goes a little bit, but then it just stops. Am I doing something wrong, or is <code>OnDownloadUpdated</code> not a good place to put that? Any suggestions of how to fix this?</p>
  
  <p><strong><em>Edit:</em></strong></p>
  
  <p>I am using <code>CefSharp 39.0.0-pre03</code>. Also, when the save file dialog comes up, no matter if you click Save or Cancel, the browser always triggers a <code>LoadError</code>, so it loads the custom HTML error page I made, and since it requires a URL for loading HTML, I put in "<a href="http://rendering/" rel="nofollow">http://rendering/</a>"... So I guess that would be a domain change. That issue (in the comments) could be the problem, but then we also need to figure out why it is triggering a <code>LoadError</code>.</p>