Bytes Converter Function
A simple function that converts Bytes to GB, MB or KB.
Code Snippet:
Function SetBytes(Bytes,fKB)if fKB=True then Bytes = Bytes * 1024If Bytes >= 1073741824 ThenSetBytes = FormatNumber((Bytes / 1024 / 1024 / 1024),2,,-1,-1) & " GB"ElseIf Bytes >= 1048576 ThenSetBytes = FormatNumber((Bytes / 1024 / 1024),2,,-1,-1) & " MB"ElseIf Bytes >= 1024 ThenSetBytes = FormatNumber((Bytes / 1024),2,,-1,-1) & " KB"ElseIf Bytes < 1024 ThenSetBytes = Bytes & " Bytes"End IfEnd Function
If at first you fail, call it version 1.0
No comments:
Post a Comment