Case DBT_DEVICEREMOVECOMPLETE 'U盘卸载
ListBox1.Items.Add("U盘卸载!")
BtnWrite.Enabled = False
BtnRead.Enabled = False
Case DBT_DEVICEREMOVEPENDING
Case DBT_DEVICETYPESPECIFIC
Case DBT_DEVNODES_CHANGED
Case DBT_QUERYCHANGECONFIG
Case DBT_USERDEFINED
End Select
End If
MyBase.WndProc(m)
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ListBox1.Items.Add("请您现在插入U盘至USB接口!")
End Sub
Private Sub BtnWrite_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnWrite.Click
If ComboBox1.Text = "" Then
MsgBox("请选择U盘盘符!", MsgBoxStyle.Exclamation, "Warn")
Else
Dim Writer As StreamWriter = Nothing
Try
Dim fileName As String = ComboBox1.Text + "Test.txt"
Writer = New StreamWriter(fileName)
Writer.WriteLine(InputBox("老四vb.net移除u盘,请输入要保存的字符串", "输入信息", "Input then Test String! hehe!"))
MsgBox("Write to " + fileName + " Success!")
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, "Write 失败")
Finally
If Writer IsNot Nothing Then Writer.Close()
End Try
End If
End Sub
Private Sub BtnRead_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnRead.Click
If ComboBox1.Text = "" Then
MsgBox("请选择U盘盘符!", MsgBoxStyle.Exclamation, "Warn")
Else
Dim Reader As StreamReader = Nothing
Try
Dim fileName As String = ComboBox1.Text + "Test.txt"
Reader = New StreamReader(fileName)
MsgBox("Read from " + fileName + vbCrLf + Reader.ReadToEnd, MsgBoxStyle.Information, "Info")
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, "Read 失败")
Finally
If Reader IsNot Nothing Then Reader.Close()
End Try
End If
End Sub
End Class
vb.net移除u盘的介绍就聊到这里吧,感谢你花时间阅读本站内容 , 更多关于vb删除命令、vb.net移除u盘的信息别忘了在本站进行查找喔 。
推荐阅读
- 视频欣赏代表什么意思,视频鉴赏
- 南阳古城广告推广效果如何,河南南阳古城广告电子版
- 怀念角色扮演游戏视频,角色扮演类游戏大全
- 网站毕业设计html,网站毕业设计指导记录
- php分页数据 php实现分页显示
- 怎么使用移动硬盘不发热,怎么使用移动硬盘不发热呢
- 关于棋牌游戏怎么开通免流的信息
- php将对象转换为数据 php 类型转换
- 乌克兰用什么直播软件,乌克兰用什么交流软件