以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  遍历选择的问题  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=89917)

--  作者:douglas738888
--  发布时间:2016/9/1 11:42:00
--  遍历选择的问题

请老师,帮忙看看,想实现:只要遍历后发现表里面多行中,只要有一行的逻辑列为TRUE后,就显示项目的图片,这里不绑定列

 

CurrentChanged: 

Dim dr As DataRow = DataTables("在途_Table2").find("项目编号 = \'" & e.Table.current("项目编号") & "\'")
For Each r As DataRow In DataTables("在途_Table2").DataRows
If Forms("在途").Opened Then
    Dim pbx As WinForm.PictureBox = Forms("在途").Controls("PictureBox2")
    If r IsNot Nothing Then
        If dr("结束") = True Then
            pbx.Image = getimage("Green.ico") \'显示印章图片
        Else
            pbx.Image = getimage("Red.ico") \'显示印章图片
        End If
    Else
        pbx.Image = Nothing \'不显示图片
    End If
End If
Next

[此贴子已经被作者于2016/9/1 11:42:36编辑过]

--  作者:有点蓝
--  发布时间:2016/9/1 12:15:00
--  
If e.Table.current IsNot Nothing Then
    Dim dr As DataRow = DataTables("在途_Table2").find("项目编号 = \'" & e.Table.current("项目编号") & "\' and 结束=true")
    Dim pbx As WinForm.PictureBox = Forms("在途").Controls("PictureBox2")
    If dr IsNot Nothing Then
        pbx.Image = getimage("Green.ico") \'显示印章图片
    Else
        pbx.Image = getimage("Red.ico") \'显示印章图片
    End If
End If

--  作者:douglas738888
--  发布时间:2016/9/1 14:05:00
--  

蓝老师,如果通过筛选,表中有行时,能正常显示条件图片了,如果表中没有任何行时,不显示任何图片,怎样改下面的代码

 

If e.Table.current IsNot Nothing Then
    Dim dr As DataRow = DataTables("在途_Table2").find("项目编号 = \'" & e.Table.current("项目编号") & "\' and 结束=true")
    Dim pbx As WinForm.PictureBox = Forms("在途").Controls("PictureBox2")
    If dr IsNot Nothing Then
        pbx.Image = getimage("Green.ico") \'显示图片
    Else
        pbx.Image = getimage("Red.ico") \'显示图片
    If e.Table.current Is Nothing Then
        pbx.Image = Nothing \'不显示图片

       End If
    End If
End If


--  作者:有点蓝
--  发布时间:2016/9/1 14:47:00
--  
If e.Table.current IsNot Nothing Then
    Dim dr As DataRow = DataTables("在途_Table2").find("项目编号 = \'" & e.Table.current("项目编号") & "\'")
    Dim pbx As WinForm.PictureBox = Forms("在途").Controls("PictureBox2")
    If dr Is Nothing Then
        pbx.Image = Nothing
    Else
        dr  = DataTables("在途_Table2").find("项目编号 = \'" & e.Table.current("项目编号") & "\' and 结束=true")
        If dr IsNot Nothing Then
            pbx.Image = getimage("Green.ico") \'显示印章图片
        Else
            pbx.Image = getimage("Red.ico") \'显示印章图片
        End If
    End If
End If

--  作者:douglas738888
--  发布时间:2016/9/1 16:48:00
--  

请蓝老师,问题还存在,做了个例子,请您看看这个测试例子,窗口 名称是“在途” ,表中已经没有数据了,但是,如果先点击筛选出来的行,根据条件显示图片后,再筛选没有数据的空表,图片依然呈现最后一次的加载表的条件,我用return返回也没有效果

测试步骤:1. 打开“在途”窗口      2. 左边选择 年和月的参数  查询   3. 有数据的行在 2016年 7月  和8月  按条件显示图片

谢谢!!   登录 888

 

 

 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:测试.zip


--  作者:有点蓝
--  发布时间:2016/9/1 17:15:00
--  
Dim pbx As WinForm.PictureBox = Forms("在途").Controls("PictureBox2")
If e.Table.current IsNot Nothing Then
    Dim dr As DataRow = DataTables("在途_Table2").find("项目编号 = \'" & e.Table.current("项目编号") & "\'")
    If dr Is Nothing Then
        pbx.Image = Nothing
        Return
    Else
        dr  = DataTables("在途_Table2").find("项目编号 = \'" & e.Table.current("项目编号") & "\' and 结束=true")
        If dr IsNot Nothing Then
            pbx.Image = getimage("Green.ico") \'显示印章图片
        Else
            pbx.Image = getimage("Red.ico") \'显示印章图片
        End If
    End If
Else
    pbx.Image = Nothing
End If