Foxtable(狐表)用户栏目专家坐堂 → 关于排考室座位号的问题


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

主题:关于排考室座位号的问题

帅哥,在线噢!
jhxb8821
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:三尾狐 帖子:630 积分:4620 威望:0 精华:0 注册:2016/4/15 22:24:00
  发帖心情 Post By:2023/9/11 15:56:00 [只看该作者]

原代码:

AfterLoad

Dim dr As DataRow

Dim tv As WinForm.TreeView

tv =e.Form.Controls("学员列表树")

tv.BuildTree("考试数据表", "班代码|学号")

'tv.BuildTree("考试数据表", "入学时间|校区|班名称中文|姓名")

'tv.BuildTree("考试数据表", "入学时间|校区|班代码|学号")

For Each nd As WinForm.TreeNode In tv.AllNodes

    If nd.Level = 0 Then

    nd.BackColor = Color.Gainsboro

    dr = DataTables("考试数据表").find("班代码 = '" & nd.Name & "'")

    If dr IsNot Nothing Then

        nd.text = dr("班名称中文")

    End If

    Else If nd.Level = 1

        dr = DataTables("考试数据表").find("学号 = '" & nd.Name & "'")

        If dr IsNot Nothing Then

            nd.text = dr("姓名")

        End If

   End If

Next

tv.Nodes.Insert("全部学员", "全部学员", 0)

 

For Each nd As WinForm.TreeNode In tv.AllNodes

    If nd.Name <> "全部学员" And nd.AllNodes.Count > 0 Then

        nd.MoveRight

    End If

Next

 

目录树AfterCheckNode代码

Dim nd,nd1 As  WinForm.TreeNode

nd = e.node

If nd.Nodes.Count > 0

    For Each nd1 In nd.AllNodes

        nd1.Checked = nd.Checked

    Next

End If

If e.node.Checked = False

    Do While  nd.parentnode IsNot Nothing

        nd = nd.parentnode

        If nd.Nodes.Count > 0

            For i As Integer = 0 To nd.Nodes.Count -1

                If nd.Nodes(i).Checked = True

                    Exit Do

                End If

                If i = nd.Nodes.Count -1

                    nd.Checked = False

                End If

            Next

        End If

    Loop

Else

    Do While  nd.parentnode IsNot Nothing

        nd = nd.parentnode

        nd.Checked = True

    Loop

End If

Dim bdm,xh,tj As String

Dim cnt,jds As Integer

For Each nd In e.Form.Controls("学员列表树").nodes("全部学员").AllNodes

    If nd.Level = 1 And nd.Checked = True Then

        bdm = nd.name

        cnt = nd.AllNodes.Count

        For Each nd1 In nd.AllNodes

            If nd1.Checked = True

                xh = xh & "," & nd1.name

                jds = jds +1

                If jds = cnt

                    xh = "all"

                End If

            Else

                If xh > ""

                    xh = xh.Replace("all","")

                End If

            End If

        Next

        If xh > ""

            xh = xh.Trim(",")

        End If

        jds = 0

        tj = tj & "|" & bdm & "\" & xh

        If tj > ""

            tj = tj.Trim("|")

        End If

    End If

Next

 

Dim jztj As  String

 

If tj > ""

    e.Form.Controls("加载条件").text = tj.Replace("|",vbcrlf)

    jztj = tj.Replace("|",vbcrlf)

Else

    e.Form.Controls("加载条件").text = ""

End If

 

想实现的效果

AfterLoad

Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1")

trv.BuildTree("考试数据表", "入学时间|校区|班名称中文|姓名")'使用排序

trv.Nodes.Insert("全部学员", 0)

目录树AfterCheckNode代码

Dim nms As String() = {"入学时间", "校区", "班名称中文", "姓名"} '指定生成目录树的各列

Dim qts As String() = {"'", "'", "'", "'"} '指定将各列的值括起来的符号,这里都是字符型,所以都是单引号

Dim trv As WinForm.TreeView = e.Sender

Dim flt As String

Dim nd As WinForm.TreeNode

Dim trv1 As WinForm.TreeView = e.Form.Controls("TreeView1")

If e.Node.Name = "全部学员" Then

   ' Tables("考试数据表").Filter = ""

    Tables("考试数据表").Filter = flt

End If

For Each nd1 As WinForm.TreeNode In e.Node.AllNodes '清除子节点的选中标记

    nd1.Checked = e.Node.Checked

Next

Dim pd As WinForm.TreeNode = e.Node.ParentNode

If pd IsNot Nothing Then

    Dim bb As Boolean = True

    For Each nd2 As WinForm.TreeNode In pd.Nodes

        If nd2.Checked = False Then

            bb = False

            Exit For

        End If

    Next

    pd.Checked = bb

End If

For Each nd In trv.AllNodes

    If nd.Checked Then

        Dim rts() As String = nd.FullPath.Split("\")

        Dim val As String = ""

        For i As Integer = 0 To rts.length - 1

            If val > "" Then

                val = val & " And "

            End If

            val = val & nms(i) & " = " & qts(i) & rts(i) & qts(i)

        Next

        If flt > "" Then

            flt = flt & " Or (" & val & ")"

        Else

            flt = val

        End If

    End If

Next

Tables("考试数据表").Filter = flt

 

请教如何修改前面的代码?


 回到顶部
总数 72 1 2 3 4 5 6 7 8 下一页