以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  项目事件  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=56202)

--  作者:gcc123
--  发布时间:2014/9/1 9:07:00
--  项目事件

项目中有很多表,在每个表窗口中设置一个打印列按钮,按钮的代码能不能加入到项目事件或全局表事件当中呢?省的每个表都得重复加按钮代码

表中代码如下:

Dim l As Integer = Tables("鲁H78062").LeftCol
Dim r As Integer = Tables("鲁H78062").RightCol

For Each c As Col In Tables("鲁H78062").cols
    If c.index < l OrElse c.Index > r Then
        c.Visible=False
    End If
Next


Tables("鲁H78062").Print(True,False)


For Each c As Col In Tables("鲁H78062").cols
    c.Visible=True
Next


--  作者:Bin
--  发布时间:2014/9/1 9:12:00
--  
写到菜单按钮里面去  Tables("鲁H78062")  改为currenttable
--  作者:有点甜
--  发布时间:2014/9/1 9:12:00
--  

 不能,你每个按钮都必须写代码。

 

 不过你可以写少一点代码,具体情况根据你的情况而定。

 

 编写内部函数

 

Dim t As Table = Args(0)

Dim l As Integer = t.LeftCol
Dim r As Integer = t.RightCol

For Each c As Col In t.cols
    If c.index < l OrElse c.Index > r Then
        c.Visible=False
    End If
Next


t.Print(True,False)


For Each c As Col In t.cols
    c.Visible=True
Next

 

按钮代码

 

 Functions.Execute("函数名", Tables("表A"))


--  作者:gcc123
--  发布时间:2014/9/1 12:16:00
--  
谢谢
--  作者:gcc123
--  发布时间:2014/9/1 12:17:00
--  
谢谢