vb.net添加组件 vb的控件怎么添加

vb.net 怎么添加Windows Media Player控件? 注意是VB.NET不是VB“工具箱”中单击右键 , 选择“选择项”菜单,打开“选择工具箱项”窗口,选择“
COM组件
”标签,在列表中找到并勾选“Windows
Media
Player”组件 , 单击“确定”按钮 。将该组件添加到指定的工具箱
选项卡
中 , 然后在工具箱里面找
Windows
Media
Player
控件,拉到form里面,拉出来的控件就是AxWindowsMediaPlayer
如何给VB.NET窗体添加子窗体?直接添加一个MID父窗体或在已有窗体vb.net添加组件的属性中找到IsMDIContainer属性vb.net添加组件,然后设置为True,然后创建第二个窗体  , 需要加载子窗体的时候:
Dim NewMDIChild As New Form2
NewMDIChild.MdiParent = Me
NewMDIChild.Show()
Public Shared Sub CheckMDIChildForm(ByVal MDIForm As Windows.Forms.Form, ByVal MDIChildForm As Windows.Forms.Form, ByVal MDIChildFormName As String)
If MDIForm.MdiChildren.Length1 Then
'如果没有任何一个MDI子窗体,则创该MDI子窗体的窗体实例
Dim MDIChildFrm As Windows.Forms.Form = MDIChildForm ' 定义MDI子窗体
MDIChildFrm.MdiParent = MDIForm '指定父窗体
MDIChildFrm.Show() '打开窗体
Exit Sub
Else
Dim x As Integer
Dim frmyn As Boolean
For x = 0 To (MDIForm.MdiChildren.Length) - 1
Dim tempChild As Windows.Forms.Form = CType(MDIForm.MdiChildren(x), Windows.Forms.Form)
If tempChild.Name = MDIChildFormName Then
'检测到有该MDI子窗体,设为激活 并退出循环
frmyn = True
tempChild.BringToFront()
Exit For
Else
frmyn = False
End If
Next
If Not frmyn Then
'在打开的窗体中没检测到则新建
Dim MDIChildFrm As Windows.Forms.Form = MDIChildForm ' 定义MDI子窗体
MDIChildFrm.MdiParent = MDIForm '指定父窗体
MDIChildFrm.Show() '打开窗体
End If
End If
End Sub
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
【vb.net添加组件 vb的控件怎么添加】上面代码放到一个调用过程中
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的控件怎么添加的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息 , 记得收藏关注本站 。

    推荐阅读