Foxtable(狐表)用户栏目专家坐堂 → listview查询显示问题


  共有3450人关注过本帖平板打印复制链接

主题:listview查询显示问题

帅哥哟,离线,有人找我吗?
15201801280
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:婴狐 帖子:28 积分:227 威望:0 精华:0 注册:2020/4/13 22:35:00
listview查询显示问题  发帖心情 Post By:2020/5/3 19:40:00 [只看该作者]


图片点击可在新窗口打开查看此主题相关图片如下:12.png
图片点击可在新窗口打开查看


点击查询按钮,表格中的数据会根据条件刷新,但listview的显示的数据不会变,如果需要跟着一起变,要怎么处理。

Dim Filter As String
With e.Form.Controls("comboBox1")
    If .Value IsNot Nothing Then
        Filter = "温区 = '" & .Value & "'"
    End If
End With
With e.Form.Controls("TextBox1")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "条码 = '" & .Value & "'"
    End If
End With
With e.Form.Controls("TextBox2")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "商品名称 = '" & .Value & "'"
    End If
End With
If Filter > "" Then
    Tables("商品基础信息").Filter = Filter
End If
'-------------------------------------------------------------------
Dim lvw As WinForm.ListView = e.Form.Controls("ListView1")
lvw.View = ViewMode.Details
lvw.Reset()
lvw.RetrieveAll()
lvw.GridLines=True
Dim cls() As String = {"编码","条码","商品名称","箱规","放码数","温区","保质期天数","毛重","外径长","外径宽","外径高","备注"} '定义列名
Dim wds() As String = {60,120,300,60,60,120,60,60,60,60,60,100} '定义列宽
For i As Integer = 0 To  cls.Length - 1  '增加列
    Dim c As WinForm.ListViewColumn = lvw.Columns.Add()
    c.Text = cls(i) '指定列标题
    c.Name = cls(i) '指定列名
    c.Width = wds(i) '指定列宽
Next
For Each dr As DataRow In DataTables("商品基础信息").DataRows '从数据表中提取数据
    Dim vr As  WinForm.ListViewRow =  lvw.Rows.Add() '增加一行
    For Each cl As String In cls '逐列取值
        vr(cl) = dr(cl)
    Next
    vr.Tag= dr
Next


数据表中只有1行,但liestview中会所有的显示出来,不过双击listview中的记录,未在数据表中的那条记录无任何反应。
[此贴子已经被作者于2020/5/3 20:24:19编辑过]

 回到顶部