Senin, 17 Juni 2013

MENAMPILKAN KETERANGAN DRIVER MENGGUNAKAN VB.NET 2008

Menampilkan keterangan driver pada VB.Net 2008


Coding Program

Imports System.IO
Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        cmddriver.Items.AddRange(IO.DriveInfo.GetDrives)
    End Sub

    Private Sub cmddriver_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmddriver.SelectedIndexChanged
        keterangan.Items.Clear()
        keterangan.Items.Add("Nama Drive : " & Dir("" & cmddriver.Text & "", FileAttribute.Volume) & "")
        keterangan.Items.Add("Sistem         : " & Dir("" & cmddriver.Text & "", FileAttribute.System) & "")
        Dim Dvr As New DriveInfo(cmddriver.Text)
        Dim kapasitas = CStr(Dvr.TotalSize / 1000000) & " MB"
        Dim sisa = CStr(Dvr.TotalFreeSpace / 1000000) & " MB"
        Dim Terpakai = CStr(Val(kapasitas) + Val(sisa)) & " MB"
        keterangan.Items.Add("kapasitas     : " & kapasitas)
        keterangan.Items.Add("Terpakai      : " & Terpakai)
        keterangan.Items.Add("Sisa             : " & sisa)
    End Sub

End Class

Hasilnya



Tidak ada komentar:

Posting Komentar