Code:
Public Function getFileSize(ByVal path As String) As String
Dim sizes() As String = New String() {"B", "KB", "MB", "GB"}
Dim len As Double = (New FileInfo(path) + Length)
Dim order As Integer = 0
While ((len >= 1024) _
AndAlso (order + (1 < sizes.Length)))
order = (order + 1)
len = (len / 1024)
End While
Return String.Format("{0:0.##} {1}", len, sizes(order))
End Function