以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]窗口运行时,执行操作后,窗口自动关闭了,想问一下是哪里出现问题了? (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=184791) |
-- 作者:小梧桐 -- 发布时间:2023/1/3 12:50:00 -- [求助]窗口运行时,执行操作后,窗口自动关闭了,想问一下是哪里出现问题了? 您好,以下代码我写在表事件里面的click中。在窗口运行时,我点这个表,运行以下操作,窗口会自动关闭,想问一下是哪里出现问题呢 Dim str1 As String = Tables("原因关键词1").current("关键词1") Dim str2 As String = Tables("原因关键词1").current("关键词2") Dim filter As String If str2 = "" Then filter = "原因 Like \'%" & str1 & "%\'" Else filter = "原因 Like \'%" & str1 & "%\'" & " And " & "原因 Like \'%" & str2 & "%\'" End If Tables("HAZOP").Filter = filter Dim txt3 As WinForm.TextBox = e.Form.Controls("TextBox3") txt3.text = Tables("HAZOP").Rows.Count DataTables("后果ID统计").DataRows.Clear() Dim b As New GroupTableBuilder("后果ID", DataTables("HAZOP")) b.Groups.AddDef("后果主题ID") \'根据后果主题ID分组 b.Totals.AddDef("后果主题ID", AggregateEnum.Count, "出现次数") b.filter = Tables("HAZOP").filter b.Build \'生成统计表 MainTable = Tables("后果ID") \'打开生成的统计表 Tables("后果ID").Save() Dim Cols1() As String = {"后果主题ID", "出现次数"} Dim Cols2() As String = {"后果主题ID", "出现次数"} For Each r1 As Row In Tables("后果ID") Dim r2 As Row = Tables("后果ID统计").AddNew() For i As Integer = 0 To Cols1.Length - 1 r2(Cols2(i)) = r1(Cols1(i)) Next Next
|
-- 作者:新福星 -- 发布时间:2023/1/3 13:27:00 -- 此主题相关图片如下:qq图片20230103132615.png |
-- 作者:有点蓝 -- 发布时间:2023/1/3 13:29:00 -- 窗口添加一个按钮,把代码放到窗口按钮里,不要放到表事件。然后后面代码改为 …… Dim b As New GroupTableBuilder("后果ID", DataTables("HAZOP")) b.Groups.AddDef("后果主题ID") \'根据后果主题ID分组 b.Totals.AddDef("后果主题ID", AggregateEnum.Count, "出现次数") b.filter = Tables("HAZOP").filter dim dt as datatable = b.Build(true) \'生成统计表http://www.foxtable.com/webhelp/topics/1910.htm Dim Cols1() As String = {"后果主题ID", "出现次数"} Dim Cols2() As String = {"后果主题ID", "出现次数"} For Each r1 As dataRow In dt .datarows Dim r2 As Row = Tables("后果ID统计").AddNew() For i As Integer = 0 To Cols1.Length - 1 r2(Cols2(i)) = r1(Cols1(i)) Next Next |