以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  隐藏选择的列  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=172718)

--  作者:cd_tdh
--  发布时间:2021/10/27 17:20:00
--  隐藏选择的列

老师,自己选择隐藏的列,选择多列只隐藏了最后一个,循环没对,应该怎么修改:

Dim pxfs As WinForm.CheckedComboBox = e.Form.Controls("显示隐藏列")

For Each cl As Col In Tables("工程款台账管理").Cols
    Dim lst1 As new List(of String)
    lst1.AddRange(pxfs.Text.Split(","))
    For Each s1 As String In lst1
        If cl.name = s1 Then
            cl.Visible = False
        Else
            cl.Visible = True
        End If
    Next
Next


--  作者:有点蓝
--  发布时间:2021/10/27 17:34:00
--  

Dim pxfs As WinForm.CheckedComboBox = e.Form.Controls("显示隐藏列")

For Each cl As Col In Tables("工程款台账管理").Cols

cl.Visible = True

next

For Each s as string In pxfs.Text.Split(",")

Tables("工程款台账管理").Cols(s).Visible = False
Next


--  作者:有点蓝
--  发布时间:2021/10/27 17:35:00
--  
或者

Dim pxfs As WinForm.CheckedComboBox = e.Form.Controls("显示隐藏列")

Dim lst1 As new List(of String)
    lst1.AddRange(pxfs.Text.Split(","))

For Each cl As Col In Tables("工程款台账管理").Cols

cl.Visible = not lst1.contains(cl.name)

next