Thursday, June 20, 2013

Get Byte Size in MB Using C# Windows Application


CREATE FUNCTION

static double ConvertBytesToMegabytes(long bytes)
{
            return (bytes / 1024f) / 1024f;
}

Write This Code In Page Load Event

// Now convert to a string in megabytes.
string s = ConvertBytesToMegabytes(6955008).ToString("0.00");

// Convert bytes to megabytes.
MessageBox.Show(s + " MB");

No comments :

Post a Comment