以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 窗口中多选择筛选 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=83875) |
-- 作者:kaituozhe -- 发布时间:2016/4/19 5:45:00 -- 窗口中多选择筛选 以下代码是窗口的一段代码,目的是想实现多选择筛选,使用comboBox1一次只能筛选一个公司数据,目前想实现筛选多个公司数据,编写了以下代码,标黄色颜色的出现了错误了,该怎么改进,如何才能实现目的。 Case "checkedcomboBox1" Dim txt As String = e.Form.Controls("checkedcomboBox1").Text If txt = "" Then tbl.DataTable.loadFilter = "" tbl.DataTable.load() Else Dim lis() As String =txt.Split(",") Dim filter As String For Each li As String In lis filter = "公司名称 Like " & "\'%" & li & "%\'" Or Next \'txt = "\'%" & txt & "%\'" \'tbl.DataTable.loadFilter = "公司名称 Like " & txt tbl.DataTable.loadFilter =filter tbl.DataTable.load() End If
|
-- 作者:Hyphen -- 发布时间:2016/4/19 8:49:00 -- Case "checkedcomboBox1" Dim txt As String = e.Form.Controls("checkedcomboBox1").Text If txt = "" Then tbl.DataTable.loadFilter = "" tbl.DataTable.load() Else dim filter = "公司名称 in (\'" & txt.Replace(",","\',\'") & "\')" \'txt = "\'%" & txt & "%\'" \'tbl.DataTable.loadFilter = "公司名称 Like " & txt tbl.DataTable.loadFilter =filter tbl.DataTable.load() End If
|