Formating File Sizes


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Formating File Sizes

  1. #1
    Join Date
    Jul 2005
    Posts
    55

    Formating File Sizes

    Hello,

    I need to know how to Format file sizes when they hit a certain point...

    I'm using FileLen to obtain the files size in bytes, but after hitting a certain point, the FileLen overflows.

    Heres my code:

    Dim i As Integer
    Dim file As Integer

    For i = 0 To File1.ListCount - 1
    file = FileLen(File1.Path & "\" & File1.List(i))
    List1.AddItem file & " bytes"

    Ive tried this...

    If file > 1024 Then
    file = Format$(FileLen(File1.Path & "\" & File1.List(i))
    End If

    But it doesn't seem to work

    Anybody have any ideas or can help?

    Thanks

  2. #2
    Join Date
    Jun 2005
    Location
    On a computer
    Posts
    4

    Lightbulb

    Try this...

    Dim I as long

    instead of an integer

    A Long is a 4 byte integer while an Integer is a 2 byte integer
    I'm a nobody...
    Nobody's Perfect, so I'm Perfect

Similar Threads

  1. wav file fade in out help
    By jase_dukerider in forum C++
    Replies: 2
    Last Post: 04-14-2005, 08:48 PM
  2. Help on Formating XML file ??
    By serge calderara in forum .NET
    Replies: 3
    Last Post: 04-12-2005, 02:10 PM
  3. How long before the next version??
    By _CAG in forum .NET
    Replies: 146
    Last Post: 08-12-2002, 11:40 PM
  4. File uploading / objFile.Write problem
    By Tomer Cagan in forum ASP.NET
    Replies: 1
    Last Post: 07-24-2001, 10:01 AM
  5. NullPointerException when reading text file
    By Andrew McLellan in forum Java
    Replies: 3
    Last Post: 05-09-2001, 06:34 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center