[Visual Studio 2008] Webclient kilobyte naar megabyte

Status
Niet open voor verdere reacties.

creative

Gebruiker
Lid geworden
25 dec 2006
Berichten
298
Hallo mede helpers,

Ik heb een probeempje met mijn WebClient. Als hij een file aan het downloaden is dan staat er bij de download size: 19850 MB en wil graag dat het er zo uit ziet: 198.50 MB

Hier is mijn code:

Code:
Dim ontvangen As Integer = e.BytesReceived / 10485

Mvg Creative
 
Ik heb het gevonden!

Code:
Function SetBytes(ByVal Bytes As String)



        If Bytes >= 1073741824 Then
            SetBytes = Format(Bytes / 1024 / 1024 / 1024, "#0.00") & " GB"
        ElseIf Bytes >= 1048576 Then
            SetBytes = Format(Bytes / 1024 / 1024, "#0.00") & " MB"
        ElseIf Bytes >= 1024 Then
            SetBytes = Format(Bytes / 1024, "#0.00") & " KB"
        ElseIf Bytes < 1024 Then
            SetBytes = Fix(Bytes) & " Bytes"
        End If



    End Function
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan