|
-
May 31st, 2000, 05:31 AM
#1
Thread Starter
New Member
I want to see what the size of files are on my computer from my program, but I can only show what the size is in bytes. What i would want is to see the size of files in kbytes. Can anyone who knows tell me that?
Thanx
-
May 31st, 2000, 05:33 AM
#2
Multiply the KB by 1000 to get the bytes.
-
May 31st, 2000, 05:37 AM
#3
Frenzied Member
-
May 31st, 2000, 05:43 AM
#4
Hyperactive Member
*smirk* And, ahem, dividing by 1024 may get even closer.
{I read it backwards the first time too. That's why I was smirking. Please, No disrespect intended!!! We're all human.}
[Edited by Mongo on 05-31-2000 at 09:44 PM]
-
May 31st, 2000, 05:47 AM
#5
Convert bytes to K or MB:
Code:
Dim FileSize1 As String
Dim FileSize2 As String
'Code:
Private Function FileSize()
' convert the current file size to different format
Static xx
FileSize1 = FileLen(File1.Path & "\" & File1.List(0))
xx = FileSize1 / 1024
If Len(FileSize1) >= 7 Then
FileSize2 = Format((xx / 1024), "0.00")
FileSize2 = FileSize2 & " MB"
ElseIf Len(FileSize1) >= 4 Then
xx = Format((FileSize1 / 1024), "0.00")
FileSize2 = xx & " K"
Else
FileSize2 = FileSize1 & " Bytes"
End If
Debug.Print "File: " & File1.List(0) & vbCrLf & "Old Size: "; FileSize1 & _
vbCrLf & "New Size: " & FileSize2
Me.Caption = File1.List(0) & " - Size: " & FileSize2
End Function
Private Sub FileSize(ffile)
' convert the current file size to different format
FileSize1 = FileLen(ffile)
xx = FileSize1 / 1024
If Len(FileSize1) >= 7 Then
FileSize2 = Format((xx / 1024), "0.00")
FileSize2 = FileSize2 & " MB"
ElseIf Len(FileSize1) >= 4 Then
xx = Format((FileSize1 / 1024), "0.00")
FileSize2 = xx & " K"
Else
FileSize2 = FileSize1 & " Bytes"
End If
Debug.Print "File: " & ffile & vbCrLf & "Old Size: "; FileSize1 & _
vbCrLf & "New Size: " & FileSize2
Me.Caption = ffile & " - Size: " & FileSize2
End Sub
-
May 31st, 2000, 05:49 AM
#6
I must have read it wrong (seriously). I thought he wanted to convert KB into Bytes.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|