0
我有下面的代碼(它通過C:驅動器並獲取文件信息數據)並且想要將長度轉換爲「可尊敬的」數字 - 即MB。問題是下面的代碼對代碼沒有任何幫助。任何幫助,將理解:轉換爲MB不起作用
行是:strlength = strlength *(1024/1024)
私人小組btnclick_Click(BYVAL發件人爲System.Object的,BYVALË作爲System.EventArgs)把手btnclick.Click
Dim strFilesinfo As System.IO.FileInfo
Dim strlength As Double = 0
Dim strname As String = ""
For Each strFiles As String In My.Computer.FileSystem.GetFiles("c:\")
strFilesinfo = My.Computer.FileSystem.GetFileInfo(strFiles)
strlength = strFilesinfo.Length
strname = strFilesinfo.Name
strlength = strlength * (1024/1024)
lstData.Items.Add(strname & " " & strlength)
Next
End Sub
末級
strlength = strlength *(1024/1024)?我認爲1024/1024將返回1,它只會返回strlength的值。 – Anuraj 2011-02-15 15:58:10