工具箱右鍵單擊——選擇項……——選擇.net組件或com組件——點擊“瀏覽”選擇控件dll文件,然后工具箱中就會出現(xiàn)新加的控件
創(chuàng)新互聯(lián)公司專注于榮縣網(wǎng)站建設(shè)服務(wù)及定制,我們擁有豐富的企業(yè)做網(wǎng)站經(jīng)驗。 熱誠為您提供榮縣營銷型網(wǎng)站建設(shè),榮縣網(wǎng)站制作、榮縣網(wǎng)頁設(shè)計、榮縣網(wǎng)站官網(wǎng)定制、微信平臺小程序開發(fā)服務(wù),打造榮縣網(wǎng)絡(luò)公司原創(chuàng)品牌,更為您提供榮縣網(wǎng)站排名全網(wǎng)營銷落地服務(wù)。
“工具箱”中單擊右鍵,選擇“選擇項”菜單,打開“選擇工具箱項”窗口,選擇“COM組件”標(biāo)簽,在列表中找到并勾選“Windows Media Player”組件,單擊“確定”按鈕。將該組件添加到指定的工具箱選項卡中,然后在工具箱里面找 Windows Media Player 控件,拉到form里面,拉出來的控件就是AxWindowsMediaPlayer
Private WithEvents NewTextBox As TextBox
'通過使用WithEvents關(guān)鍵字聲明一個對象變量為新的命令按鈕
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
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
上面代碼放到一個調(diào)用過程中
Private Sub FileSystemWatcher1_Created(sender As Object, e As FileSystemEventArgs) Handles FileSystemWatcher1.Created
‘我用fsw的path屬性區(qū)別多個分區(qū),你用自己的代碼就行,如果你沒有創(chuàng)建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