以文本方式查看主题

-  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=110592)

--  作者:rainxiao
--  发布时间:2017/12/6 8:08:00
--  [求助]列筛选排序的问题
想要对一个表进行筛选排序,窗体中有一个combobox控件,一个按钮,一个副本表格。想达成的效果是对combobox中输入的列名称的那一列进行筛选排序,筛选条件是筛选出有值的所有行。试了很久代码也不太对,请教下各位老师,这段代码应该怎么写呀?
还有就是我想把进行筛选的列显示在表格的前几列,因为这个表列数太多了,不知道这个可以不可以做到?谢谢大家,帮忙看一下

--  作者:有点甜
--  发布时间:2017/12/6 9:51:00
--  

参考代码,TextChanged事件

 

Dim lm As String = e.Sender.Text
Dim t As Table = Tables("表A")
If t.cols.Contains(lm) Then
    t.filter = lm & " is not null"
    t.cols(lm).move(0)
End If


--  作者:rainxiao
--  发布时间:2017/12/6 10:27:00
--  
以下是引用有点甜在2017/12/6 9:51:00的发言:

参考代码,TextChanged事件

 

Dim lm As String = e.Sender.Text
Dim t As Table = Tables("表A")
If t.cols.Contains(lm) Then
    t.filter = lm & " is not null"
    t.cols(lm).move(0)
End If




谢谢老师,还想问下,如果想要排序的话,sort语句应该怎么写呀?


--  作者:有点蓝
--  发布时间:2017/12/6 12:10:00
--  

Dim lm As String = e.Sender.Text
Dim t As Table = Tables("表A")
If t.cols.Contains(lm) Then
    t.filter = lm & " is not null"
    t.cols(lm).move(0)
    t.sort = “某某列”
End If



--  作者:rainxiao
--  发布时间:2017/12/6 13:02:00
--  
以下是引用有点蓝在2017/12/6 12:10:00的发言:

Dim lm As String = e.Sender.Text
Dim t As Table = Tables("表A")
If t.cols.Contains(lm) Then
    t.filter = lm & " is not null"
    t.cols(lm).move(0)
    t.sort = “某某列”
End If


老师你好,我是弄不懂如果用筛选那一列进行排序的话应该用什么代码。表达式总是写不对




--  作者:有点甜
--  发布时间:2017/12/6 14:20:00
--  

Dim lm As String = e.Sender.Text
Dim t As Table = Tables("表A")
If t.cols.Contains(lm) Then
    t.filter = lm & " is not null"
    t.cols(lm).move(0)
    t.sort = lm
End If


--  作者:rainxiao
--  发布时间:2017/12/6 14:43:00
--  
谢谢老师,麻烦你了
--  作者:rainxiao
--  发布时间:2017/12/12 14:48:00
--  
以下是引用有点甜在2017/12/6 14:20:00的发言:

Dim lm As String = e.Sender.Text
Dim t As Table = Tables("表A")
If t.cols.Contains(lm) Then
    t.filter = lm & " is not null"
    t.cols(lm).move(0)
    t.sort = lm
End If 




老师你好,我现在想加一个按钮,效果是点击之后是降序排列,代码不是应该就是后面加上DESC吗?t.sort = lm DESC这段代码不正确吗?


--  作者:有点甜
--  发布时间:2017/12/12 15:11:00
--  
Dim lm As String = e.Sender.Text
Dim t As Table = Tables("表A")
If t.cols.Contains(lm) Then
    t.filter = lm & " is not null"
    t.cols(lm).move(0)
    t.sort = lm & " desc"
End If 

--  作者:rainxiao
--  发布时间:2017/12/12 15:32:00
--  
以下是引用有点甜在2017/12/12 15:11:00的发言:
Dim lm As String = e.Sender.Text
Dim t As Table = Tables("表A")
If t.cols.Contains(lm) Then
    t.filter = lm & " is not null"
    t.cols(lm).move(0)
    t.sort = lm & " desc"
End If 
老师,这样改提示一个这样的错误“排序字符串包含一个不在 IBindingList 中的属性。”