Hello,
SEE BOTTOM OF THIS POST FOR UPDATE ON THIS PLEASE.
I have the below code that searches through directories and displays the largest file in the directory. the problem is that it displays it in KB - how on earth do I convert it to MB? The file size comes out way too large so want easier reading - thanks for the help:
Private Sub btnGetMax_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGetMax.Click
ClearList()
Dim dblSize As Integer = 0
Dim dblMax As Integer = 0
Dim strMax As String = ""
Dim objFileInfo As System.IO.FileInfo
For Each strFile As String In My.Computer.FileSystem.GetFiles("c:\temp", FileIO.SearchOption.SearchAllSubDirectories)
objFileInfo = My.Computer.FileSystem.GetFileInfo(strFile)
/*whats the size of the files?*/
dblSize = objFileInfo.Length
If dblSize > dblMax Then
dblMax = dblSize
strMax = objFileInfo.FullName
End If
Next
MessageBox.Show("Largest file in .Net folder is " & vbCrLf &
strMax & vbCrLf &
dblMax.ToString("N0"))
End Sub
SHOULD HAVE MADE MYSELF MORE CLEAR! I KNOW HOW TO CONVERT KB TO MB BUT NO IDEA HOW I INCORPORATE THAT INTO MY CODE - DO I ADD ANOTHER VARIABLE FOR STRMAX AS /1024.....EXCEPT I ALREADY HAVE STRMAX VARIABLE.....STILL VERY MUCH A BEGINNER GUYS.
I know how to convert KB to MB - the problem is how do I incorporate that into my code? Do I add another variable