On 27 Dec 2003 13:34:58 +0100,
hi************* **@gmx.at (Herfried K.
Wagner [MVP]) wrote:
* dgk <so************ ******@zero-spam-hotmail.com> scripsit: Having searched far and wide in the net classes, and then having
searched far and wide in this newsgroup, it is obvious that there is
no Drive object.
As Armin says, that's not the right place for the question.
In .NET 2.0, there will be a 'DriveInfo' class:
<http://longhorn.msdn.m icrosoft.com/lhsdk/ref/ns/system.io/c/driveinfo/driveinfo.aspx>
Ok. Looks like something they just didn't have time to finish.
ACK. Have a look at the complete class tree, a lot of new classes will
be added which were missing since .NET 1.0.
;-)
Just one more thing then. The example in the MSDN library for
Freespace uses FSO and I don't want to. I swiped some of this code
from a previous post of yours and I just cannot figure out how to drop
the drive name or volume or any other property into a listbox. Can you
please tell me what I'm doing wrong? The 1 to Length-1 is intentional,
I'm skipping A: because I didn't want to start off with a removable
drive just in case that was a problem. As is, I'm getting an Invalid
Class error for each drive. I've tried a hundred permutations of this
code.
For i = 1 To Drives.Length - 1
DriveL = "Win32_LogicalD isc.DeviceID=" & Chr(34) &
Drives(i).Subst ring(0, 2) & Chr(34)
'DriveL = "Win32_LogicalD isc.DeviceID="" C:" & """"
Dim Mydisk As New System.manageme nt.ManagementOb ject(DriveL)
MessageBox.Show ("Testing " & Mydisk.Path.ToS tring) ' this is
just returning DriveL, which is a string. But no error.
Dim diskProperty As System.Manageme nt.PropertyData
Try
ListBox1.Items. Add(Mydisk.Prop erties("FreeSpa ce").ToString )
'For Each diskProperty In Mydisk.Properti es
' ListBox1.Items. Add(diskPropert y.Name)
' 'ListBox1.Items .Add(diskProper ty.Value)
'Next
' ListBox1.Items. Add(Mydisk.Prop erties("Name"))
Catch ex As System.Exceptio n
MsgBox("Error is " & ex.Message)
End Try
Next