README.md
December 5, 2022 ยท View on GitHub
Description
This code will enable you to convert bytes to kilobytes or megabytes, whichever you choose. Vote if ya wanna.
More Info
| Submitted On | |
| By | CovertLoop |
| Level | Beginner |
| User Rating | 3.0 (18 globes from 6 users) |
| Compatibility | VB 4.0 (16-bit), VB 4.0 (32-bit), VB 5.0, VB 6.0 |
| Category | Coding Standards |
| World | Visual Basic |
| Archive File |
Source Code
Private Declare Function StrFormatByteSize Lib _
"shlwapi" Alias "StrFormatByteSizeA" (ByVal _
dw As Long, ByVal pszBuf As String, ByRef _
cchBuf As Long) As String
Public Function FormatKB(ByVal Amount As Long) _
As String
Dim Buffer As String
Dim Result As String
Buffer = Space$(255)
Result = StrFormatByteSize(Amount, Buffer, _
Len(Buffer))
If InStr(Result, vbNullChar) > 1 Then
FormatKB = Left$(Result, InStr(Result, _
vbNullChar) - 1)
End If
End Function