各位:
我的程序里,有个窗口里添加了table控件,在窗口的afterload事件里,调用一个外部表,然后把这个表和table控件绑定,并设置了显示列,但是奇怪的是,table控件显示的列有些不是我设置的列:
Dim tablePay As WinForm.Table = e.Form.Controls("tablePay")
'调用外部表
If DataTables.Contains(strTableName) = False
Dim q As new OuterTableBuilder
q.TableName = strTableName
q.TableCaption = strTableName
q.C
q.SelectString = "Select * From " & strTableName
q.Build
DataTables.load(strTableName)
'生成狐表
End If
'绑定表
tablePay.Table.DataSource = DataTables(strTableName)
'BuildDataSource()
'tablePay.Table.Select
Tables(strTableName).filter = "1=1"
Tables(strTableName).sort = "员工id"
Tables(strTableName).Cols("应发").Visible = False
Tables(strTableName).Cols("净发").Visible = False
Tables(strTableName).Cols("部门名称").Visible = False
'绑定列
Dim strCols As String = ""
For Each cl As Col In Tables(strTableName).Cols
If cl.name = "岗位id" Or cl.name = "部门id" Or cl.name = "_Identify" Or cl.name = "员工id" Or cl.name="应发" Or cl.name="净发" Or cl.name="部门名称" Or cl.name="在职状态"
Continue For
End If
If strCols = ""
strCols = cl.name & "|" & Str(cl.name.length * 18)
Else
strCols = strCols & "|" & cl.name & "|" & Str(cl.name.length * 18)
End If
Next
MessageBox.show(strCols)
Tables(strTableName).Cols("应发").Visible = False
Tables(strTableName).Cols("净发").Visible = False
Tables(strTableName).Cols("部门名称").Visible = False
tablePay.Table.SetColVisibleWidth(strCols)
tablePay.Table.Cols("应发").Visible = False
tablePay.Table.Cols("净发").Visible = False
tablePay.Table.Cols("部门名称").Visible = False
以下是MessageBox出来的列信息:
此主题相关图片如下:11.jpg
以下是显示的界面:
此主题相关图片如下:2.jpg