Directory and File Info
Format the file size to bytes, KB or MB
Public Function FormatSize(ByVal RawData As Long) As String If RawData > 1048576 Then Return Format(RawData / 1048576, "#.## MB") End If If RawData > 1024 Then Return CStr(RawData \ 1024) + " KB" End If Return CStr(RawData) + " bytes"End Function
Implementation
Dim fs As System.IO.Stream
fs = myDialog.OpenFile()Me.lblSize.Text = FormatSize(fs.Length)