Results 1 to 6 of 6

Thread: Counting file sizes and lenghts together

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2006
    Posts
    11

    Counting file sizes and lenghts together

    Hi, I have couple questions for you... Be gentle, I'm a beginner

    1. If I know a file's size in bytes, how can I convert it to decimal that shows it in megabytes with 3 or more digits? As in, 0,00 MB?

    2. How can I count many files together in format like 0,00 MB?

    3. If I know an mp3 file's lenght in seconds and milliseconds (stored in System.Time variable), how can I display it like 00:00:00 (hh:mm:ss)?

    5. How can I count file lenghts together like using format 00:00:00?

  2. #2

  3. #3
    PowerPoster JuggaloBrotha's Avatar
    Join Date
    Sep 2005
    Location
    Lansing, MI; USA
    Posts
    4,286

    Re: Counting file sizes and lenghts together

    This may help
    Last edited by JuggaloBrotha; Jun 30th, 2010 at 03:00 PM.
    Currently using VS 2015 Enterprise on Win10 Enterprise x64.

    CodeBank: All ThreadsColors ComboBoxFading & Gradient FormMoveItemListBox/MoveItemListViewMultilineListBoxMenuButtonToolStripCheckBoxStart with Windows

  4. #4

    Thread Starter
    New Member
    Join Date
    Oct 2006
    Posts
    11

    Re: Counting file sizes and lenghts together

    Thank you both for your answers. Now, if only someone could help me with formatting System.Time...

  5. #5
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,290

    Re: Counting file sizes and lenghts together

    The play time of your mp3 file is a duration of time, so you would use the TimeSpan class. Once you get the play time as a timespan object, you can do calculations and call its ToString method to display it.

  6. #6

    Thread Starter
    New Member
    Join Date
    Oct 2006
    Posts
    11

    Re: Counting file sizes and lenghts together

    Thank you stanav for your answer, it didn't quite explain it to me but I was on the right track by your answer. Actually, this is what I was after:

    Format (System.TimeSpan.Hours.ToString, "00")

    (In case someone else needs to know this stuff...)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width