以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助]fill语句形成的表如何取得width  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=23326)

--  作者:aloby
--  发布时间:2012/9/9 8:09:00
--  [求助]fill语句形成的表如何取得width
tstr="Select [_Identify],[zt],[工资表名],[设置],[" & dc.name & "] As " & dr(dc.name) 
tstr = tstr & " From {工资表}" \'ckgl是数据源名称,[编号]是主键,必须包含
DataTables("工资_table1").Fill(tstr,False) 
Dim tx1 As WinForm.TextBox = e.Form.Controls("TextBox1")
Tables("工资_table1").Filter = "[工资表名] = \'" & Value(0) & "\' And [zt] = \'" & vars("账套") & "\'"
\'\'\'\'\'\'以下显示当前列
Dim x2 As String
For Each c1 As Col In Tables("工资_table1").Cols
    If x2=""
        x2= c1.name &  "|" & c1.width
    Else
        x2=x2 & "|" & c1.name &  "|" & c1.width
    End If
Next
tx1.Value = x2
显示各列的宽度为-1,要手动调整一列的宽度,它才出来一列的宽度


--  作者:狐狸爸爸
--  发布时间:2012/9/9 9:26:00
--  

-1表示此列的宽度为默认列宽。

你可以用下面的语句获得默认列宽:

 

Dim w AS integer = Tables("工资_table1").Grid.Cols.Defaultsize

当然你也可以设置默认列宽:

 

Tables("工资_table1").Grid.Cols.Defaultsize = 80