SDittmar Posted February 27, 2003 Posted February 27, 2003 Im trying to convert bytes to kilobytes or megabytes and back again. I have these two functions: Function DivideTimes(Byval number As Single, iterations As Integer) As Single Dim x As Integer For x = 1 to iterations number /= 1024 Next Return number End Function Function TimesTimes(ByVal number As Single, iterations As Integer) As Single Dim x As Integer For x = 1 to iterations number *= 1024 Next Return number End Function My question is, is there a more efficient way to do these functions? they just seem kinda clunky... Quote
*Gurus* divil Posted February 27, 2003 *Gurus* Posted February 27, 2003 To divide: number /= (1024 ^ iterations) To multiply: number *= (1024 ^ iterations) Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
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.