Amir,

The following VB.NET code will list the drives on your local computer,
their size, and volume label:

    Dim mos As System.Management.ManagementObjectSearcher
    Dim mo As System.Management.ManagementObject
    Dim sDevice As String
    Dim sSize As String
    Dim sLabel As String

    mos = New System.Management.ManagementObjectSearcher("SELECT DeviceID,
Size, VolumeName FROM Win32_LogicalDisk")

    For Each mo In mos.Get()
        sDevice = mo.Properties("DeviceID").Value.ToString()

        If mo.Properties("Size").Value Is Nothing Then
            sSize = ""
        Else
            sSize = String.Format("{0:##,##0}", _
                (Convert.ToSingle(mo.Properties("Size").Value) / 1000000#))
& " Mb  "
        End If

        If mo.Properties("VolumeName").Value Is Nothing Then
            sLabel = ""
        Else
            sLabel = "Label:" & mo.Properties("VolumeName").Value.ToString()
        End If

        MsgBox(sDevice & "  " & sSize & sLabel)
    Next mo

Your project may require a reference to System.Management.dll

On Tue, 18 Jun 2002 19:03:16 +0000, Amir Kamran <[EMAIL PROTECTED]> wrote:

>Hello!
>
>Is there a class or some thing else through which information about
>paritcular dirves can get like label, size etc.
>
>
>_________________________________________________________________
>Join the world’s largest e-mail service with MSN Hotmail.
>http://www.hotmail.com
>
>You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
>subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to