重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
“工具箱”中单击右键,选择“选择项”菜单,打开“选择工具箱项”窗口,选择“COM组件”标签,在列表中找到并勾选“Windows Media Player”组件,单击“确定”按钮。将该组件添加到指定的工具箱选项卡中,然后在工具箱里面找 Windows Media Player 控件,拉到form里面,拉出来的控件就是AxWindowsMediaPlayer
创新互联自2013年创立以来,是专业互联网技术服务公司,拥有项目成都网站设计、网站制作网站策划,项目实施与项目整合能力。我们以让每一个梦想脱颖而出为使命,1280元黄龙做网站,已为上家服务,为黄龙各地企业和个人服务,联系电话:13518219792
For Each i In My.Computer.FileSystem.Drives
Dim FSW As New FileSystemWatcher
FSW.NotifyFilter = NotifyFilters.FileName
FSW.Path = i.Name.ToString
FSW.Filter = "*.txt"
AddHandler FSW.Changed, AddressOf FileSystemWatcher1_Changed '与FileSystemWatcher1_Changed事件绑定,以下同。
AddHandler FSW.Created, AddressOf FileSystemWatcher1_Created
AddHandler FSW.Deleted, AddressOf FileSystemWatcher1_Deleted
AddHandler FSW.Disposed, AddressOf FileSystemWatcher1_Disposed
AddHandler FSW.Error, AddressOf FileSystemWatcher1_Error
AddHandler FSW.Renamed, AddressOf FileSystemWatcher1_Renamed
FSW.EnableRaisingEvents = True
Next
上面代码放到一个调用过程中
Private Sub FileSystemWatcher1_Created(sender As Object, e As FileSystemEventArgs) Handles FileSystemWatcher1.Created
‘我用fsw的path属性区别多个分区,你用自己的代码就行,如果你没有创建FileSystemWatcher1,就把Handles FileSystemWatcher1.Created删除。
If sender.path = "C:\" Then
'代码
ElseIf sender.path = "D:\" Then
'代码
ElseIf sender.path = "F:\" Then
ElseIf sender.path = "H:\" Then
'……
End If
End Sub
工具箱右键单击——选择项……——选择.net组件或com组件——点击“浏览”选择控件dll文件,然后工具箱中就会出现新加的控件
Dim Bt as New Button
Bt.Size=New Size(100,100)
Bt.Location=New Point(100,100)
Bt.Text="New Button"
Me.Controls.Add(Bt)
Private WithEvents NewTextBox As TextBox
'通过使用WithEvents关键字声明一个对象变量为新的命令按钮
Private Sub Command1_Click()
If NewTextBox Is Nothing Then
Set NewTextBox = Controls.Add("VB.TextBox", "cmdNew", Form1)
NewTextBox.Move 200, 200
NewTextBox.Width = Form1.Width - 450
NewTextBox.Height = Form1.Height - 1400
NewTextBox.Visible = True
End If
End Sub
Private Sub Command2_Click()
If NewTextBox Is Nothing Then
Exit Sub
Else
Controls.Remove NewTextBox
Set NewTextBox = Nothing
End If
End Sub