以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  COMBOBOX取列名的问题  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=100270)

--  作者:douglas738888
--  发布时间:2017/5/8 15:39:00
--  COMBOBOX取列名的问题

请教老师,下面代码可以取得表的列名,因为最后两列不需要在Combobox里面进行选择,怎样在组合框里不显示最后两列的列名称

 

Dim s As String
Dim s1 As String = "列名称"
For Each c As Col In Tables("总因子").Cols
    If s1.Contains(c.name ) = False Then
        s &= c.name & "|"
    End If
Next
e.Form.Controls("ComboBox1").ComboList = s.Trim("|")


--  作者:有点色
--  发布时间:2017/5/8 15:45:00
--  
Dim s As String
Dim t As Table = Tables("总因子")
Dim s1 As String = "列名称|" & t.Cols(t.Cols.Count-2).Name & "|" & t.Cols(t.Cols.Count-1).Name & "|"
For Each c As Col In Tables("总因子").Cols
    If s1.Contains(c.name & "|") = False Then
        s &= c.name & "|"
    End If
Next
e.Form.Controls("ComboBox1").ComboList = s.Trim("|")