-- 作者:cd_tdh
-- 发布时间:2019/12/23 17:19:00
--
双击代码
If e.Col.name = "待办事项" Then Dim r As Row = Tables("主窗口_Table2").Current Dim dd As String = r("ID") Dim nm As String = r("表名") Dim ck As String = r("窗口名") Dim yq As String = r("页签名") If DataTables.Contains(nm) = False DataTables.Load(nm) End If Functions.Execute("增加页签",ck,yq) DataTables(nm).Save() \'接下来要根据主键查找,必须先保存,因为只有保存后新增行的主键才是有效值. Dim dr As DataRow = DataTables(nm).Find("[ID] = \'" & dd & "\'") If dr Is Nothing Then DataTables(nm).AppendLoad("[ID] = \'" & dd & "\'") dr = DataTables(nm).Find("[ID] = \'" & dd & "\'") Else dr.Load() End If If dr IsNot Nothing Then Dim wz As Integer = Tables(nm).FindRow("[ID] = \'" & dd & "\'") If wz < 0 Then \'如果因为筛选导致此合同签订类不可见 Tables(nm).Filter = "" wz =Tables(nm).FindRow(dr) End If If wz >= 0 Then Tables(nm).Position = wz Tables(nm).TopVisibleRow = wz \'定位行后设置为第一个可见行位置,http://www.foxtable.com/webhelp/scr/2358.htm End If End If End If
|
-- 作者:cd_tdh
-- 发布时间:2019/12/23 17:21:00
--
窗口加载后:
\'待办事项 Dim cmd7 As New SQLCommand Dim dt7 As DataTable cmd7.C onnectionName = cmd7.CommandText = "S elect [_Identify],[表名],[窗口名],[页签名],[审批状态],[待审批人],[待办事项],[ID],[所属机构],[查看] From {待办事项}" dt7 = cmd7.ExecuteReader() With Tables("主窗口_Table2") .DataSource = dt7 .Cols.Remove("表名","窗口名","页签名","审批状态","待审批人","ID","所属机构","查看") .DefaultRowHeight = 25 \'所有行高 .Cols("待办事项").TextAlign = TextAlignEnum.left .grid.ScrollBars = 0 \'禁止滚动条,0 无 1 横向 2 纵向 3 横向纵向 .DataTable.SysStyles("EmptyArea").BackColor = Color.White \'空白区背景色 .DataTable.SysStyles("Alternate").BackColor = Color.Azure \'交替行颜色 .grid.Styles("EmptyArea").Border.Color = Color.White \'表格边框颜色 .ExtendLastCol = True \'自动列宽 .grid.rows(0).height = 0 \'隐藏表头
For Each r As Row In Tables("主窗口_Table2").Rows If r("审批状态") <> "待分公司负责人审批" Then .Filter = "[待审批人] = \'" & _UserPost & "\'" \'e.Form.Controls("待办事项").Text = "待办事项:(" & dt7.Compute("count([待审批人])","待审批人 = \'" & _UserPost & "\'") & ")条" e.Form.Controls("待办事项").Text = dt7.Compute("count([待审批人])","待审批人 = \'" & _UserPost & "\'") Else .Filter = "[所属机构] = \'" & _UserGroup & "\'" \'e.Form.Controls("待办事项").Text = "待办事项:(" & dt7.Compute("count([所属机构])","所属机构 = \'" & _UserGroup & "\'") & ")条" e.Form.Controls("待办事项").Text = dt7.Compute("count([所属机构])","所属机构 = \'" & _UserGroup & "\'") End If Next .Select(-1,-1) \'移除焦点行 End With
|
-- 作者:cd_tdh
-- 发布时间:2019/12/24 13:08:00
--
老师,我发现是应为移除了焦点行的问题,只要移除了焦点行,在Table控件内空白处一单击就报错,还死循环。这个怎么处理.
窗口afterload事件
\'待办事项 Dim cmd7 As New SQLCommand Dim dt7 As DataTable cmd7.C onnectionName = cmd7.CommandText = "S elect [_Identify],[表名],[窗口名],[页签名],[审批状态],[待审批人],[待办事项],[ID],[所属机构],[查看] From {待办事项}" dt7 = cmd7.ExecuteReader() With Tables("主窗口_Table2") .DataSource = dt7 .Cols.Remove("表名","窗口名","页签名","审批状态","待审批人","ID","所属机构","查看") .DefaultRowHeight = 25 \'所有行高 .Cols("待办事项").TextAlign = TextAlignEnum.left .grid.ScrollBars = 0 \'禁止滚动条,0 无 1 横向 2 纵向 3 横向纵向 .DataTable.SysStyles("EmptyArea").BackColor = Color.White \'空白区背景色 .DataTable.SysStyles("Alternate").BackColor = Color.Azure \'交替行颜色 .grid.Styles("EmptyArea").Border.Color = Color.White \'表格边框颜色 .ExtendLastCol = True \'自动列宽 .grid.rows(0).height = 0 \'隐藏表头
For Each r As Row In Tables("主窗口_Table2").Rows If r("审批状态") <> "待分公司负责人审批" Then .Filter = "[待审批人] = \'" & _UserPost & "\'" \'e.Form.Controls("待办事项").Text = "待办事项:(" & dt7.Compute("count([待审批人])","待审批人 = \'" & _UserPost & "\'") & ")条" e.Form.Controls("待办事项").Text = dt7.Compute("count([待审批人])","待审批人 = \'" & _UserPost & "\'") Else .Filter = "[所属机构] = \'" & _UserGroup & "\'" \'e.Form.Controls("待办事项").Text = "待办事项:(" & dt7.Compute("count([所属机构])","所属机构 = \'" & _UserGroup & "\'") & ")条" e.Form.Controls("待办事项").Text = dt7.Compute("count([所属机构])","所属机构 = \'" & _UserGroup & "\'") End If Next .Select(-1,-1) \'移除焦点行 End With
[此贴子已经被作者于2019/12/24 13:11:15编辑过]
|