Click here to Skip to main content
15,899,679 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Filesize Conversion Pin
DaveAuld5-May-10 4:55
professionalDaveAuld5-May-10 4:55 
GeneralRe: Filesize Conversion Pin
Richard MacCutchan5-May-10 7:31
mveRichard MacCutchan5-May-10 7:31 
GeneralRe: Filesize Conversion Pin
scottgp5-May-10 7:43
professionalscottgp5-May-10 7:43 
GeneralRe: Filesize Conversion Pin
Paul Conrad6-May-10 9:15
professionalPaul Conrad6-May-10 9:15 
GeneralRe: Filesize Conversion Pin
Dayekh5-May-10 3:14
Dayekh5-May-10 3:14 
GeneralRe: Filesize Conversion Pin
Luc Pattyn5-May-10 3:45
sitebuilderLuc Pattyn5-May-10 3:45 
GeneralRe: Filesize Conversion Pin
DaveAuld5-May-10 4:59
professionalDaveAuld5-May-10 4:59 
GeneralRe: Filesize Conversion Pin
Dayekh5-May-10 6:16
Dayekh5-May-10 6:16 
Thank you all for your input. I have finally written a function to do exactly what I need to be done. Please look at the code below and benefit from it if you wish:

Public Function BytesFormatting(ByVal Bytes As Integer) As String

    Dim FormattedFileSize As Double

    If Bytes < 1024 Then
        ''code to format fsize as KB
        Dim dblFormatted As Double
        dblFormatted = Bytes
        FormattedFileSize = Format(dblFormatted, "###,###.00") + "KB"

    ElseIf (Bytes > 1024 And Bytes < 1048576) Then
        ''code to format fsize as KB
        Dim dblFormatted As Double
        dblFormatted = (Bytes + 1023) / 1024
        FormattedFileSize = Format(dblFormatted, "###,###.00") + "KB"

    ElseIf Bytes > 1048576 Then
        ''code to format fsize as MB
        Dim dblFormatted As Double
        dblFormatted = (Bytes / 1024) / 1024
        FormattedFileSize = Format(dblFormatted, "###,###,###.00") + "MB"
    End If

    Return FormattedFileSize.ToString
End Function

GeneralRe: Filesize Conversion Pin
The Man from U.N.C.L.E.5-May-10 6:39
The Man from U.N.C.L.E.5-May-10 6:39 
GeneralRe: Filesize Conversion Pin
Dayekh5-May-10 6:45
Dayekh5-May-10 6:45 
GeneralRe: Filesize Conversion Pin
riced5-May-10 8:34
riced5-May-10 8:34 
GeneralRe: Filesize Conversion Pin
Luc Pattyn5-May-10 8:37
sitebuilderLuc Pattyn5-May-10 8:37 
GeneralRe: Filesize Conversion Pin
riced5-May-10 9:54
riced5-May-10 9:54 
GeneralRe: Filesize Conversion Pin
Luc Pattyn5-May-10 10:33
sitebuilderLuc Pattyn5-May-10 10:33 
GeneralRe: Filesize Conversion Pin
riced5-May-10 10:49
riced5-May-10 10:49 
GeneralRe: Filesize Conversion Pin
Luc Pattyn5-May-10 12:20
sitebuilderLuc Pattyn5-May-10 12:20 
GeneralRe: Filesize Conversion Pin
riced5-May-10 22:09
riced5-May-10 22:09 
GeneralRe: Filesize Conversion Pin
Dayekh5-May-10 12:06
Dayekh5-May-10 12:06 
QuestionWeb Service Problems Pin
RobThompson5-May-10 0:25
RobThompson5-May-10 0:25 
AnswerRe: Web Service Problems Pin
Wayne Gaylard5-May-10 2:21
professionalWayne Gaylard5-May-10 2:21 
AnswerRe: Web Service Problems Pin
Dave Kreskowiak5-May-10 4:16
mveDave Kreskowiak5-May-10 4:16 
QuestionConvert into Char Pin
Anubhava Dimri4-May-10 19:11
Anubhava Dimri4-May-10 19:11 
AnswerRe: Convert into Char Pin
Richard MacCutchan4-May-10 21:39
mveRichard MacCutchan4-May-10 21:39 
GeneralRe: Convert into Char Pin
Anubhava Dimri4-May-10 21:57
Anubhava Dimri4-May-10 21:57 
GeneralRe: Convert into Char Pin
Richard MacCutchan4-May-10 22:09
mveRichard MacCutchan4-May-10 22:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.