以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- [求助]窗体执行完后自动关闭,是怎么回事? (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=157173) |
-- 作者:zqxzhs -- 发布时间:2020/10/6 10:51:00 -- [求助]窗体执行完后自动关闭,是怎么回事? 请教老师:在窗体上建立了一个按钮,代码如下,单击后执行没有问题,但窗口执行完后自动关闭,没有关闭窗口的命令,请老师看看代码有什么问题,请指教! Dim y As Integer = e.Form.Controls("年度").text Dim m As Integer = e.Form.Controls("月份").text Dim dt1 As New Date(y, m, 1) Dim dt2 As New Date(y, m, Date.DaysInMonth(y,m)) \'获取该月的最后一天 Dim Filter As String Filter = "登记日期>= \'" & dt1 & "\' And 登记日期<= \'" & dt2 & "\'" Tables("轧胶绩效_Table1").DataTable.LoadFilter = Filter Tables("轧胶绩效_Table1").DataTable.Load Dim dt As DataTable Dim dtb As New DataTableBuilder("计件工资") dtb.AddDef("年度", Gettype(String), 16) dtb.AddDef("月份", Gettype(String), 16) dtb.AddDef("姓名", Gettype(String), 16) \'dtb.AddDef("登记日期", Gettype(String), 16) dtb.AddDef("小计", Gettype(Double)) dt = dtb.Build() Dim lst As New Dictionary(of String ,DataRow) \'定义一个字典,用于检索每个员工在统计表中对应的行 For Each dr1 As DataRow In Tables("轧胶绩效_Table1").DataTable.DataRows If dr1.IsNull("姓名") = False Then \'如果工号列不为空 Dim nms() As String = dr1("姓名").Split(",") \'将工号列内容拆分成数组 Dim v As Double = dr1("小计") / nms.Length \'获得平均之后每个工号的生产数量 For Each nm As String In nms \'遍历参与加工此产品的每个工号 Dim dr2 As DataRow If lst.ContainsKey(nm) \'如果集合中包括此工号对应的行 dr2= lst(nm) \'将此行赋值给变量dr2 Else dr2 = dt.AddNew() \'否则增加一行. dr2("年度") = y dr2("月份") = m dr2("姓名") = nm \'新增行的工号列设置为此工号 lst.add(nm,dr2) \'将新增行添加到字典中,以便接下来检索 End If dr2("小计") = dr2("小计") + v \'加上平均后的产量 Next End If Next Dim Cols1() As String = {"年度","月份","姓名","小计"} Dim Cols2() As String = {"年度","月份","姓名","月绩效"} For Each ddr1 As DataRow In DataTables("计件工资").Select("[小计] > 0") Dim ddr2 As DataRow =Tables("轧胶绩效_Table2").DataTable.AddNew() For i As Integer = 0 To Cols1.Length -1 ddr2(Cols2(i)) = ddr1(Cols1(i)) Next Next DataTables("绩效工资").Save()
|
-- 作者:有点蓝 -- 发布时间:2020/10/6 11:03:00 -- 检查下表事件,应该是其他事件影响的 |