您好,以下代码我写在表事件里面的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