Search Tools Links Login

Bytes -> Megabytes Converter Function


Converts a figure represented in bytes to the corresponding figure in megabytes, formatted to two decimal places. With a little modification, this could also be converted into a multi-value converter for kilobytes, gigabytes, terabytes, petabytes, etc.

Public Function BytesToMegabytes(Bytes As Double) As Double
   'This function gives an estimate to two decimal
   'places.  For a more precise answer, format to
   'more decimal places or just return dblAns
  Dim dblAns As Double
  dblAns = (Bytes / 1024) / 1024
  BytesToMegabytes = Format(dblAns, "###,###,##0.00")
End Function

About this post

Posted: 2018-02-11
By: IntellgentSolutions
Viewed: 360 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.