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


  共有4889人关注过本帖树形打印复制链接

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

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


加好友 发短信
等级:二尾狐 帖子:598 积分:4442 威望:0 精华:0 注册:2016/4/15 22:24:00
感谢蓝老师  发帖心情 Post By:2022/1/20 10:35:00 [只看该作者]

If Forms("高考排考室").Controls("NumericComboBox1").Value <= 0 Then
    MessageBox.Show("考场号不能小等于零值!","中止操作",MessageBoxButtons.OK,MessageBoxIcon.Exclamation)
Else
    Dim f As New Filler
    f.SourceTable = DataTables("高考排考室")
    f.SourceCols = "班级,姓名"
    f.DataTable = DataTables("高考排考室")
    f.DataCols = "班级,姓名"
    f.ExcludeExistValue = True
    f.Fill
    For i As Integer = 0 To CurrentTable.rows.count -1
        CurrentTable.Rows(i)("索引顺序") = Rand.Next(10000)
    Next
    CurrentTable.sort = "索引顺序"
    For b As Integer = 0 To CurrentTable.rows.count -1
        CurrentTable.Rows(b)("考场号") = Format(1 + b Mod e.Form.Controls("NumericComboBox1").Value,"100")
    Next
    
    CurrentTable.sort = "索引顺序"
    Dim k As Integer = 1
    Dim z As Integer = 1
    For b As Integer = 0 To CurrentTable.rows.count -1
        CurrentTable.Rows(b)("考场号") = Format(k,"100")  ''默认Format(k,"000")
        CurrentTable.Rows(b)("座位号") = Format(Rand.Next(30) + b Mod e.Form.Controls("NumericComboBox1").Value,"00")
        CurrentTable.Rows(b)("座位号") = z
        CurrentTable.Rows(b)("座位号") = Format(z,"00")
        z = z + 1
        If z > 30 Then
            z = 1
            k = k + 1
        End If
    Next
End If

蓝老师,这个代码很好用,由于是前面的考场排满30人后,再排后面的考场,这个填入考场数量的"NumericComboBox1"已经没有用了,取消输入考场数量这个代码就更完美了

 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  12楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:105495 积分:536466 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2022/1/20 10:48:00 [只看该作者]

去掉红色代码,多余

    For b As Integer = 0 To CurrentTable.rows.count -1
        CurrentTable.Rows(b)("考场号") = Format(k,"100")  ''默认Format(k,"000")
        CurrentTable.Rows(b)("座位号") = Format(Rand.Next(30) + b Mod e.Form.Controls("NumericComboBox1").Value,"00")
        CurrentTable.Rows(b)("座位号") = z
        CurrentTable.Rows(b)("座位号") = Format(z,"00")
        z = z + 1
        If z > 30 Then
            z = 1
            k = k + 1
        End If
    Next

 回到顶部
帅哥哟,离线,有人找我吗?
jhxb8821
  13楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:二尾狐 帖子:598 积分:4442 威望:0 精华:0 注册:2016/4/15 22:24:00
谢谢蓝老师  发帖心情 Post By:2022/1/20 11:20:00 [只看该作者]

If Forms("高考排考室").Controls("NumericComboBox1").Value <= 0 Then
    MessageBox.Show("考场号不能小等于零值!","中止操作",MessageBoxButtons.OK,MessageBoxIcon.Exclamation)
Else

    Dim f As New Filler
    f.SourceTable = DataTables("高考排考室")
    f.SourceCols = "班级,姓名"
    f.DataTable = DataTables("高考排考室")
    f.DataCols = "班级,姓名"
    f.ExcludeExistValue = True
    f.Fill
    For i As Integer = 0 To CurrentTable.rows.count -1
        CurrentTable.Rows(i)("索引顺序") = Rand.Next(10000)
    Next
    CurrentTable.sort = "索引顺序"
    For b As Integer = 0 To CurrentTable.rows.count -1
        CurrentTable.Rows(b)("考场号") = Format(1 + b Mod e.Form.Controls("NumericComboBox1").Value,"100")
    Next
    
    CurrentTable.sort = "索引顺序"
    Dim k As Integer = 1
    Dim z As Integer = 1
    For b As Integer = 0 To CurrentTable.rows.count -1
        CurrentTable.Rows(b)("考场号") = Format(k,"100")  ''默认Format(k,"000")
        CurrentTable.Rows(b)("座位号") = Format(Rand.Next(30) + b Mod e.Form.Controls("NumericComboBox1").Value,"00")
        CurrentTable.Rows(b)("座位号") = z
        CurrentTable.Rows(b)("座位号") = Format(z,"00")
        z = z + 1
        If z > 30 Then
            z = 1
            k = k + 1
        End If
    Next
End If
蓝老师,我将上面红色的都去掉,没有问题吧?

 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  14楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:105495 积分:536466 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2022/1/20 11:23:00 [只看该作者]

应该没有,测试再找问题了

 回到顶部
帅哥哟,离线,有人找我吗?
jhxb8821
  15楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:二尾狐 帖子:598 积分:4442 威望:0 精华:0 注册:2016/4/15 22:24:00
已解决  发帖心情 Post By:2022/1/20 11:26:00 [只看该作者]

非常感谢蓝老师,应该是很完美的了

 回到顶部
帅哥哟,离线,有人找我吗?
jhxb8821
  16楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:二尾狐 帖子:598 积分:4442 威望:0 精华:0 注册:2016/4/15 22:24:00
代码问题  发帖心情 Post By:2023/9/11 14:48:00 [只看该作者]

老师,帮忙看看这个窗口目录树,我想证件打印窗口中的目录树实现窗口1目录树的效果
[此贴子已经被作者于2023/9/11 15:00:16编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  17楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:105495 积分:536466 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2023/9/11 15:30:00 [只看该作者]

目录树控件没有打印属性,无法做窗口打印

 回到顶部
帅哥哟,离线,有人找我吗?
jhxb8821
  18楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


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

我想将窗口1的效果放在证件打印窗口中。怎么上传部里实例?几次都不行

 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  19楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:105495 积分:536466 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2023/9/11 15:56:00 [只看该作者]

论坛附件单个文件不能大于2M。新建一个项目做个例子发上来,不要发原项目,不要放太多测试数据


 回到顶部
帅哥哟,离线,有人找我吗?
jhxb8821
  20楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:二尾狐 帖子:598 积分:4442 威望: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 下一页