函数的代码要改一下。
''---------------------------------------------------------------------------------------------------------------------------
'''功能:模块导航窗口按钮事件 leexianfeng 日期:2016-11-14 10:14:57
Dim nm As String =Args(0)
Dim tt As String =Args(1)
Dim frmName As String
'MessageBox.show(nm & vbcrlf & tt)
Dim tabc As WinForm.TabControl = Forms("0010 首页").Controls("TabControl2")
Dim dr As DataRow =DataTables("Z99设置").Find("窗口_标题 = '"& tt &"'")
'MessageBox.show(dr("窗口_名称"))
If dr IsNot Nothing Then
frmName =dr("窗口_名称")
For a As Integer=0 To tabc.TabPages.Count-1 '如果当前页签中存在所选的页签,则跳出
If tabc.TabPages(a).Text=tt Then
tabc.SelectedIndex=a
Return Nothing
End If
Next
Forms(frmName).open(-1000,-1500) '打开窗口的位置偏移后,避免出现窗口闪退
If Forms(frmName).Opened Then
Dim pb = tabc.BaseControl
tabc.TabPages.Add(nm,tt)
Forms(frmName).BaseForm.TopLevel = False
Forms(frmName).BaseForm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None
Forms(frmName).BaseForm.Dock = System.Windows.Forms.DockStyle.Fill
'PB.TabPages(nm).Controls.Clear
PB.TabPages(nm).Controls.add(Forms(frmName).BaseForm)
tabc.SelectedPage = tabc.TabPages(nm)
tabc.SelectedPage.Image=GetImage("001.ico")
'tabc.Form.Select
'tabc.Select
End If
End If
''---------------------------------------------------------------------------------------------------------------------------