Public Class Form1
Private Shared Function GetTotalPhysicalMemory() As ULong
Return New Microsoft.VisualBasic.Devices.ComputerInfo().TotalPhysicalMemory
End Function
Private Shared Function ConvertBytesToMegabytes(bytes As Long) As Long
Return (bytes \ 1024) \ 1024
End Function
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
MessageBox.Show(ConvertBytesToMegabytes(CLng(GetTotalPhysicalMemory())).ToString() & " MB")
End Sub
End Class
No comments:
Post a Comment