符合中小企业对网站设计、功能常规化式的企业展示型网站建设
本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...
商城网站建设因基本功能的需求不同费用上面也有很大的差别...
手机微信网站开发、微信官网、微信商城网站...
首先使用 System.IO.DriveInfo.GetDrives()获取System.IO.DriveInfo,存入ds()
创新互联是专业的离石网站建设公司,离石接单;提供网站设计、做网站,网页设计,网站设计,建网站,PHP网站建设等专业做网站服务;采用PHP框架,可快速的进行离石网站开发网页制作和功能扩展;专业做搜索引擎喜爱的网站,专业的做网站团队,希望更多企业前来合作!
然后遍历ds,获取各个信息部分。
Dim ds() As System.IO.DriveInfo = System.IO.DriveInfo.GetDrives()
For i As Integer = 0 To ds.Length - 1
TextBox1.Text = TextBox1.Text + ds(i).DriveType.ToString + " " '驱动器类型
TextBox1.Text = TextBox1.Text + ds(i).Name + " " '盘符(驱动器名)
TextBox1.Text = TextBox1.Text + ds(i).IsReady.ToString + " " '是否就绪
If ds(i).IsReady = True Then
TextBox1.Text = TextBox1.Text + ds(i).VolumeLabel + " " '卷标
TextBox1.Text = TextBox1.Text + ds(i).TotalSize.ToString + " " '驱动器容量
TextBox1.Text = TextBox1.Text + ds(i).TotalFreeSpace.ToString '驱动器可用容量
End If
TextBox1.Text = TextBox1.Text + vbNewLine
Next
一下代码将自动完成检测:
Imports System.IO
Public Class Form1
Public Const WM_DEVICECHANGE = H219
Public Const DBT_DEVICEARRIVAL = H8000
Public Const DBT_DEVICEREMOVECOMPLETE = H8004
Dim DriveLetter As String
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
If m.Msg = WM_DEVICECHANGE Then
Select Case m.WParam
Case DBT_DEVICEARRIVAL
Dim s() As DriveInfo = DriveInfo.GetDrives
For Each drive As DriveInfo In s
If drive.DriveType = DriveType.Removable Then
DriveLetter = drive.Name.ToString()
Debug.WriteLine("U盘 :" DriveLetter "已插入.")
End If
Next
Case DBT_DEVICEREMOVECOMPLETE
Dim s() As DriveInfo = DriveInfo.GetDrives
For Each drive As DriveInfo In s
If drive.ToString = DriveLetter Then Exit Sub
Next
Debug.WriteLine("U盘:" DriveLetter "已卸载!")
End Select
End If
MyBase.WndProc(m)
End Sub
End Class
添加对应DriveListBox控件
代码如下:
n = Drive1.ListCount
For i = 0 To n - 1
Drive1.ListIndex = i
DrvName = Left(Drive1.Drive, 2)'这是盘符名
DrvLabel = Mid(Drive1.Drive, 3, Len(Drive1.Drive) - 2) '这是卷标名
'需要说明的是:卷标名如果为默认名称,读到是空的,可加个if显示为“本地磁盘”
Print DrvName, DrvLabel
Next i
需要帮忙,向我求助好了~ 两页一答!