以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  求格式化单元格的代码  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=15853)

--  作者:lihe60
--  发布时间:2012/1/14 14:33:00
--  求格式化单元格的代码

如何通过代码设置窗口中表的单元格的格式?

注:不是通过设置列属性等方法设置,只能用代码设置。

 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:导出表结构.table


--  作者:don
--  发布时间:2012/1/14 14:44:00
--  
參考SetFormat
--  作者:lihe60
--  发布时间:2012/1/14 14:58:00
--  

Dim t As Table = Tables("" & e.form.name & "_table1")
For Each c As col In t.cols
    If c.Isnumeric
        c.SetFormat("0.00")
    End If
Next

 

代码有误!


--  作者:mr725
--  发布时间:2012/1/14 15:12:00
--  
Dim t As Table = Tables(e.form.name & "_table1")
For Each c As col In t.cols
    If c.Isnumeric
        Tables(e.form.name & "_table1").DataTable.DataCols(c.name).SetFormat("0.00")
    End If
Next

--  作者:don
--  发布时间:2012/1/14 15:21:00
--  
以下是引用lihe60在2012-1-14 14:58:00的发言:

Dim t As Table = Tables("" & e.form.name & "_table1")
For Each c As col In t.cols
    If c.Isnumeric
        c.SetFormat("0.00")
    End If
Next

 

代码有误!


有誤是當然的,你沒認真看SETFORMAT的語法!