网站首页 > 文章中心 > 其它

vb.net+添加组件

作者:小编 更新时间:2023-09-24 18:33:03 浏览量:304人看过

vb.net 怎么添加Windows Media Player控件? 注意是VB.NET不是VB

"工具箱"中单击右键,选择"选择项"菜单,打开"选择工具箱项"窗口,选择"COM组件"标签,在列表中找到并勾选"Windows Media Player"组件,单击"确定"按钮.将该组件添加到指定的工具箱选项卡中,然后在工具箱里面找 Windows Media Player 控件,拉到form里面,拉出来的控件就是AxWindowsMediaPlayer

VB.NET 如何动态添加组件,如FileSystemWatcher,并且响应同一事件?

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

VB.net怎样加第三方控件

vb.net 窗体添加控件

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)

如何在vb.net里面动态添加控件

Private WithEvents NewTextBox As TextBox

'通过使用WithEvents关键字声明一个对象变量为新的命令按钮

Private Sub Command1_Click()

If NewTextBox Is Nothing Then

Set NewTextBox = Controls.Add("VB.TextBox", "cmdNew", Form1)

NewTextBox.Visible = True

Exit Sub

Else

Controls.Remove NewTextBox

Set NewTextBox = Nothing

以上就是土嘎嘎小编为大家整理的vb.net+添加组件相关主题介绍,如果您觉得小编更新的文章只要能对粉丝们有用,就是我们最大的鼓励和动力,不要忘记讲本站分享给您身边的朋友哦!!

版权声明:倡导尊重与保护知识产权。未经许可,任何人不得复制、转载、或以其他方式使用本站《原创》内容,违者将追究其法律责任。本站文章内容,部分图片来源于网络,如有侵权,请联系我们修改或者删除处理。

编辑推荐

热门文章