#2
shsmhq2017-06-26 10:44
|
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
End Sub
End Class
以下代码是网上的:(问题:如何把以下的代码放入以上的代码中使用?谢谢。)
Imports System.Management
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim disk As ManagementBaseObject , strResult As String
Dim diskClass = New ManagementClass("Win32_LogicalDisk") , disks As ManagementObjectCollection
disks = diskClass.GetInstances()
For Each disk In disks
strResult = ""
strResult += "磁盘名称:" & disk("Name") & vbCrLf
strResult += "磁盘卷标:" & disk("VolumeName") & vbCrLf
MsgBox(strResult)
Next
End Sub
[此贴子已经被作者于2017-6-27 10:25编辑过]