以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  删除页签  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=55291)

--  作者:jianjingmaoyi
--  发布时间:2014/8/13 22:31:00
--  删除页签
Dim TabIndex As Integer = Forms(Args(0)).Controls("TabControl1").SelectedIndex
Dim control As WinForm.TabControl = Forms(Args(0)).Controls("TabControl1")
If (TabIndex>= 0) Then
    control.TabPages.Delete(TabIndex +1)
End If


按钮事件,一直只能存在一个页签,或者同样名称的页签不可以添加

--  作者:有点甜
--  发布时间:2014/8/13 22:53:00
--  

 不明你要做什么,这个意思?

 

Dim TabIndex As Integer = e.form.Controls("TabControl1").SelectedIndex
Dim control As WinForm.TabControl = e.form.Controls("TabControl1")
For i As Integer = control.TabPages.Count - 1 To 0 Step -1
    If i <> tabIndex Then
        control.TabPages.Delete(i)
    End If
Next


--  作者:jianjingmaoyi
--  发布时间:2014/8/13 23:55:00
--  
明日测试下 我要的结果是 只保留第一个页签,其余都删除.
--  作者:Bin
--  发布时间:2014/8/14 8:28:00
--  
Dim TabIndex As Integer = e.form.Controls("TabControl1").SelectedIndex
Dim control As WinForm.TabControl = e.form.Controls("TabControl1")
For i As Integer = control.TabPages.Count - 1 To 1 Step -1
    If i <> tabIndex Then
        control.TabPages.Delete(i)
    End If
Next