crackyourinterview.com


To improves our performance please Like Share Subscribe(Will boost us)

Function to convert Bytes into GB,MB,KB,Bytes
Question Posted on 08 Nov 2011Home >> DotNet >> C# >> Function to convert Bytes into GB,MB,KB,Bytes

Below function helps you to convert bytes into GB,MB,KB and bytes:-

Function ConvertBytes(Bytes) As String
 On Error GoTo NoData
 If Bytes >= 1073741824 Then
   SetBytes = Format(Bytes / 1024 / 1024 / 1024, "#0.00") & " GB"
 ElseIf Bytes >= 1048576 Then
    SetBytes = Format(Bytes / 1024 / 1024, "#0.00") & " MB"
 ElseIf Bytes >= 1024 Then
    SetBytes = Format(Bytes / 1024, "#0.00") & " KB"
 ElseIf Bytes < 1024 Then
    SetBytes = Fix(Bytes) & " Bytes"
 End If
 Exit Function
 NoData:
   SetBytes = "0 Bytes"
End Function
0
0



.


Most Visited Questions:-

Deep Learning Questions Answers
Below are the different Deep Leaning Questions and answer a More...

Continuous Integration Questions Answers
Below are the 20 odd questions for CI or Continuous Integra More...

Derived relationships in Association Rule Mining are represented in the form of __________.
Derived relationships in Association Rule Mining are repres More...

What is Gulpjs and some multiple choice questions on Gulp
Gulpjs is an open source whihc helps in building Javascript More...

Microservices Architecture Questions Answers
Below are the different questions on Microservices Architec More...




Other Important Questions

Simplest definition of partial classes and its rules?

Definition of Tuple class with some examples?

Define Race Condition in cSharp?

C#.Net Reserve Words

can we inherit private class level variables in c#






@2014-2022 Crackyourinterview (All rights reserved)
Privacy Policy - Disclaimer - Sitemap