ADO DOT NET Posted February 8, 2008 Posted February 8, 2008 Hi, This code was converted from VB6 to VB.NET 2005: Public Function ConvertBytesToMBString(ByVal BytesDouble As Double) As String On Error Resume Next ConvertBytesToMBString = VB6.Format(BytesDouble / 1048576, "#########0.#0 MB") End Function I don't want to use Microoft.VisualBasic.Compatibility in my application! My question is that what is 100% .NET version of this code? VB6.Format(BytesDouble / 1048576, "#########0.#0 MB") Any idea? Quote
Administrators PlausiblyDamp Posted February 8, 2008 Administrators Posted February 8, 2008 Public Function ConvertBytesToMBString(ByVal BytesDouble As Double) As String Return (BytesDouble / 1048576).ToString("#########0.#0 MB") End Function should do it. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
techmanbd Posted February 8, 2008 Posted February 8, 2008 Also if you need to use an error catch, use the Try 'Your code Catch ex as exception 'handle error Quote Live as if you were to die tomorrow. Learn as if you were to live forever. Gandhi
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.