工具箱右鍵單擊——選擇項(xiàng)……——選擇.net組件或com組件——點(diǎn)擊“瀏覽”選擇控件dll文件,然后工具箱中就會出現(xiàn)新加的控件
創(chuàng)新互聯(lián)公司專注于榮縣網(wǎng)站建設(shè)服務(wù)及定制,我們擁有豐富的企業(yè)做網(wǎng)站經(jīng)驗(yàn)。 熱誠為您提供榮縣營銷型網(wǎng)站建設(shè),榮縣網(wǎng)站制作、榮縣網(wǎng)頁設(shè)計(jì)、榮縣網(wǎng)站官網(wǎng)定制、微信平臺小程序開發(fā)服務(wù),打造榮縣網(wǎng)絡(luò)公司原創(chuàng)品牌,更為您提供榮縣網(wǎng)站排名全網(wǎng)營銷落地服務(wù)。
“工具箱”中單擊右鍵,選擇“選擇項(xiàng)”菜單,打開“選擇工具箱項(xiàng)”窗口,選擇“COM組件”標(biāo)簽,在列表中找到并勾選“Windows Media Player”組件,單擊“確定”按鈕。將該組件添加到指定的工具箱選項(xiàng)卡中,然后在工具箱里面找 Windows Media Player 控件,拉到form里面,拉出來的控件就是AxWindowsMediaPlayer
Private WithEvents NewTextBox As TextBox
'通過使用WithEvents關(guān)鍵字聲明一個(gè)對象變量為新的命令按鈕
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
上面代碼放到一個(gè)調(diào)用過程中
Private Sub FileSystemWatcher1_Created(sender As Object, e As FileSystemEventArgs) Handles FileSystemWatcher1.Created
‘我用fsw的path屬性區(qū)別多個(gè)分區(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
網(wǎng)頁標(biāo)題:vb.net添加組件 vb添加控件
新聞來源:http://aaarwkj.com/article36/doodosg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站改版、動(dòng)態(tài)網(wǎng)站、響應(yīng)式網(wǎng)站、靜態(tài)網(wǎng)站、用戶體驗(yàn)、網(wǎng)站建設(shè)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)