以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  [求助]选定问题  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=79202)

--  作者:blsu33
--  发布时间:2015/12/26 9:59:00
--  [求助]选定问题

老师,

DropDownOpening 代码如下

Dim lvw As WinForm.ListView = e.Form.Controls("ListView3")

Dim ss As String = e.Form.DropDownBox.Value

If ss > "" Then

    Dim ary() As String = e.Form.DropDownBox.BindingField.Split(".")

    Dim dr As DataRow = DataTables("Z005窗表字段设置").Find("[绑定表] =\'"& ary(0) &"\' And [绑定列] =\'"& ary(1) &"\' and [绑定窗口名称]=\'通用目录树\'")

    If dr IsNot Nothing AndAlso dr.IsNull("绑定赋值列")=False AndAlso dr.IsNull("取值列")=False Then \'如果在项目表找到对应的行

        Dim vals() As String = e.Form.DropDownBox.Value.split(",")

        Dim Parts1() As String=dr("取值显示列").Split(",")

        Dim i1 As Integer

        For Each r As WinForm.ListViewRow In lvw.Rows

            For i1=0 To Parts1.Length-1

                If array.IndexOf(vals, r(Parts1(i1))) >= 0 Then

                    r.Checked = True

                    MessageBox.Show(r(Parts1(i1)) & r.Checked)

                Else

                    r.Checked = False

                End If

            Next

        Next

    Else

        For Each r As WinForm.ListViewRow In lvw.Rows

            r.Checked = False

        Next

        

    End If

End If


弹窗显示了已经为TRUE,为何复选框还不选定呢


--  作者:Hyphen
--  发布时间:2015/12/26 10:30:00
--  
代码没有问题,上传例子测试
--  作者:blsu33
--  发布时间:2015/12/27 8:36:00
--  
老师,
麻烦您给看看,窗口1


 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:复件 (2) 管理项目2.table


--  作者:blsu33
--  发布时间:2015/12/27 12:09:00
--  
红袍老师,
   下拉不知道问什么出问题,麻烦您给看看啊。

--  作者:大红袍
--  发布时间:2015/12/27 12:20:00
--  
\'下拉复选框
Dim lvw As WinForm.ListView = e.Form.Controls("ListView3")
Dim ss As String = e.Form.DropDownBox.text
For Each r As WinForm.ListViewRow In lvw.Rows
    r.Checked = False
Next
If ss > "" Then
    Dim ary() As String = e.Form.DropDownBox.BindingField.Split(".")
    Dim dr As DataRow = DataTables("Z005窗表字段设置").Find("[绑定表] =\'"& ary(0) &"\' And [绑定列] =\'"& ary(1) &"\' and [绑定窗口名称]=\'通用目录树\'")
    If dr IsNot Nothing AndAlso dr.IsNull("绑定赋值列")=False AndAlso dr.IsNull("取值列")=False Then \'如果在项目表找到对应的行
        Dim vals() As String =ss.split(",")
        Dim Parts1() As String=dr("取值显示列").Split(",")
        Dim i1 As Integer
        For Each r As WinForm.ListViewRow In lvw.Rows
            For i1=0 To Parts1.Length-1
                If array.IndexOf(vals, r(Parts1(i1))) >= 0 Then
                    r.Checked = True
                    Exit For
                End If
            Next
        Next
    End If
End If

--  作者:blsu33
--  发布时间:2015/12/27 12:33:00
--  
图片点击可在新窗口打开查看 怎么又是这个问题 谢谢老师了
--  作者:blsu33
--  发布时间:2015/12/28 10:32:00
--  
老师,
   listview的 确定按钮复选的确定按钮。
Dim lvw As WinForm.ListView = e.Form.Controls("ListView3")
Dim vls As String = ""
Dim ary() As String = e.Form.DropDownBox.BindingField.Split(".")
Dim tr As Row = Tables(ary(0)).Current

Dim dr As DataRow = DataTables("Z005窗表字段设置").Find("[绑定表] =\'"& ary(0) &"\' And [绑定列] =\'"& ary(1) &"\' AND [绑定窗口名称]=\'通用目录树\'")
If dr IsNot Nothing AndAlso dr.IsNull("绑定赋值列")=False AndAlso dr.IsNull("取值列")=False Then \'如果在项目表找到对应的行
    For Each vr As WinForm.ListViewRow In lvw.CheckedRows
        vls = vls & "," & vr.Text
    Next
    e.Form.DropDownBox.Value = vls.Trim(",")
    Dim dr1 As DataRow = lvw.Current.tag                                 这后面就不会写了,请老师指点
    Dim vals() As String = e.Form.DropDownBox.Value.split(",")
    Dim Parts2() As String=dr("取值显示列").Split(",")
    Dim i1 As Integer
    For Each r As WinForm.ListViewRow In lvw.Rows
        For i1=0 To Parts2.Length-1
            tr(Parts2(i1))=dr1(Parts2(i1))
            MessageBox.Show(tr(Parts2(i1)))
            MessageBox.Show(dr1(Parts2(i1)))
        Next
    Next
End If

e.Form.DropDownBox.CloseDropdown()

--  作者:blsu33
--  发布时间:2015/12/28 10:34:00
--  
希望达到的效果是这样的,

第一列   第二列      第三例
94,01   测试,看看   张三,李四

--  作者:大红袍
--  发布时间:2015/12/28 10:58:00
--  

Dim lvw As WinForm.ListView = e.Form.Controls("ListView3")
Dim vls As String = ""
Dim ary() As String = e.Form.DropDownBox.BindingField.Split(".")
Dim tr As Row = Tables(ary(0)).Current


Dim dr As DataRow = DataTables("Z005窗表字段设置").Find("[绑定表] =\'"& ary(0) &"\' And [绑定列] =\'"& ary(1) &"\' AND [绑定窗口名称]=\'通用目录树\'")
If dr IsNot Nothing AndAlso dr.IsNull("绑定赋值列")=False AndAlso dr.IsNull("取值列")=False Then \'如果在项目表找到对应的行
    Dim Parts1() As String=dr("取值列").Split(",")
    Dim Parts2() As String=dr("绑定赋值列").Split(",")
    Dim vals(Parts1.length-1)
    For Each vr As WinForm.ListViewRow In lvw.CheckedRows
        Dim fdr As DataRow = DataTables(dr("取值表")).find("_Identify = " & vr.Name)
        If fdr IsNot Nothing
            For i As Integer = 0 To parts1.length-1
                vals(i) &= fdr(parts1(i)) & ","
            Next
        End If
        vls = vls & "," & vr.Text
    Next
    For i As Integer = 0 To parts2.length-1
        tr(parts2(i)) = vals(i).Trim(",")
    Next
    e.Form.DropDownBox.Value = vls.Trim(",")
End If


e.Form.DropDownBox.CloseDropdown()