Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitleFormat a number of bytes in KB, MB, and GB by using StrFormatByteSize in VB .NET
DescriptionThis example shows how to format a number of bytes in KB, MB, and GB by using StrFormatByteSize in VB .NET.
Keywordsformat, bytes, KB, MB, GB, StrFormatByteSize, VB.NET
CategoriesAPI, Files and Directories
 
The FormatBytes function uses the StrFormatByteSize API function.
 
' Return a formatted string representing
' the number of bytes.
Private Function FormatBytes(ByVal num_bytes As Int32) As _
    String
    Dim txt As String

    txt = Space$(256)
    StrFormatByteSize(num_bytes, txt, Len(txt))
    FormatBytes = txt.Substring(0, txt.IndexOf(vbNullChar))
End Function
 
See also:

 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated