M
Mattia Fanti
Guest
I am downloading a file with webclient class and using content lenght in order to retrieve the file dimension. The file dimension is inside the variable FileSize. All downloaded files dimensions are summed in a Label1. Obviously if the label1 is higher than 1000(MB) then the label will be GB + value. I wrote this code, but I have a problem when value is higher than 1000. Endeed if label1 is for example
GB 1.02
a simple file of 20MB will add to Label1 a wrong value, endeed the label1 will be
GB 1.22
Instead of
GB 1.04
The code I am using is:
'I add FileSize to main counter
Label1.Text = CType((Val(label1.text) + Filesize, String)
and under label1.textchanged event:
If Val(label1.text) > 1000 Then
Label2.Text = "# GB Total Downloaded"
Label1.Text = (Val(label1.text) / 976.5625).ToString("0.00"))
Else
Label2.Text = "# MB Total Downloaded"
End If
What I am doing wrong? Thanks
Continue reading...
GB 1.02
a simple file of 20MB will add to Label1 a wrong value, endeed the label1 will be
GB 1.22
Instead of
GB 1.04
The code I am using is:
'I add FileSize to main counter
Label1.Text = CType((Val(label1.text) + Filesize, String)
and under label1.textchanged event:
If Val(label1.text) > 1000 Then
Label2.Text = "# GB Total Downloaded"
Label1.Text = (Val(label1.text) / 976.5625).ToString("0.00"))
Else
Label2.Text = "# MB Total Downloaded"
End If
What I am doing wrong? Thanks
Continue reading...