Hi
As described in the Topic I'm having some problems with changing the Progressbar (used in a statusstrip).
The DoWork sub calls a Downloadfunction, where while it downloads, the progress percentage is calculated and "reported".
Then the ProgressChanged Sub is called and the percentage is assigned to the progressbar value,
but nothing happens, not even an error.
I've copy-pasted an example from die MSDN and it worked perfectly,
but I can't find the differences which would mine not work.
Relevent Code:
Did I miss something?
As described in the Topic I'm having some problems with changing the Progressbar (used in a statusstrip).
The DoWork sub calls a Downloadfunction, where while it downloads, the progress percentage is calculated and "reported".
Then the ProgressChanged Sub is called and the percentage is assigned to the progressbar value,
but nothing happens, not even an error.
I've copy-pasted an example from die MSDN and it worked perfectly,
but I can't find the differences which would mine not work.
Relevent Code:
PHP:
Public Sub GetAddons()
LogEvent("Getting available ace addons...")
THArgument.DownloadType = 0
THArgument.Arg = "http://wowace.com/files"
If Not main.bgwrk_Download.IsBusy Then
main.bgwrk_Download.RunWorkerAsync(THArgument)
End If
End Sub
PHP:
Private Sub Downloader(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles bgwrk_Download.DoWork
Dim Result As DLTStrc = Nothing
Select Case e.Argument.DownloadType
Case 0
Result.DownloadType = 0
Result.Arg = GetIndex(e.Argument.Arg)
End Select
e.Result = Result
End Sub
Private Sub Download_ProgressChanged(ByVal sender As Object, ByVal e As System.ComponentModel.ProgressChangedEventArgs) Handles bgwrk_Download.ProgressChanged
ProgressDisplay.Value = e.ProgressPercentage
End Sub
Private Sub Download_Completed(ByVal sender As Object, ByVal e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles bgwrk_Download.RunWorkerCompleted
ProcessDownload(e.Result)
btn_ReloadIndex.Enabled = True
ProgressDisplay.Visible = False
ProgressLabel.Visible = False
LogEvent("Got Addons")
AddonListReady = True
End Sub
PHP:
Public Function GetIndex(ByVal URL As String) As String
Dim httpReq As Net.HttpWebRequest
Dim httpRes As Net.HttpWebResponse
Dim buffer(0) As Byte
Dim temp As Short = 0
Debug.Print("Getindex start: " & Date.Now.ToLongTimeString)
httpReq = System.Net.WebRequest.Create(URL & "/descript.ion")
httpRes = DirectCast(httpReq.GetResponse(), System.Net.WebResponse)
temp = httpRes.GetResponseStream.ReadByte()
While temp <> -1
If UBound(buffer) Mod 2000 = 0 Then
main.bgwrk_Download.ReportProgress(UBound(buffer) / httpRes.ContentLength * 100)
Debug.Print(Int(UBound(buffer) / httpRes.ContentLength * 100))
End If
buffer(UBound(buffer)) = temp
ReDim Preserve buffer(UBound(buffer) + 1)
temp = httpRes.GetResponseStream.ReadByte()
End While
Debug.Print("Getindex done: " & Date.Now.ToLongTimeString)
Return System.Text.Encoding.UTF8.GetString(buffer)
End Function
Did I miss something?