-- 作者:zcw728909
-- 发布时间:2013/2/5 13:52:00
-- [求助]列标题设置失效
有一个产品信息表,想让不同的用户组登录时,列标题动态改变,代码如下:
With DataTables("产品信息") Dim nmms() As String ={"电雕在制支数","机加在制支数","镀铜在制支数","车研在制支数","镀铬在制支数","料库在制支数","打样在制支数","印前在制支数","总检在制支数"} Dim nms() As String = {"电雕在制明细","机加在制明细","镀铜在制明细","车研在制明细","镀铬在制明细","料库在制明细","打样在制明细","印前在制明细","总检在制明细"} If _UserGroup <> "生产部" Then For Each nmm As String In nmms .DataCols(nmm).Caption = "在制支数" For Each nm As String In nms .DataCols(nm).Caption = "明细" Next Next Else
For Each nmm As String In nmms .DataCols(nmm).Caption = Nothing For Each nm As String In nms .DataCols(nm).Caption = Nothing Next Next End If End With
现在的问题是我以生产部登录时,列标题还是“在制支数”和“明细”,这是为什么?
|
-- 作者:zcw728909
-- 发布时间:2013/2/5 14:09:00
--
以下是引用blackzhu在2013-2-5 14:02:00的发言:
BuildHeader
重新生成表头。
这个方法应改放在代码的哪一段呢?
If _UserGroup <> "生产部" Then For Each nmm As String In nmms .DataCols(nmm).Caption = "在制支数"
.BuildHeader()
For Each nm As String In nms .DataCols(nm).Caption = "明细"
.BuildHeader() Next Next Else
For Each nmm As String In nmms .DataCols(nmm).Caption = Nothing
.BuildHeader() For Each nm As String In nms .DataCols(nm).Caption = Nothing
.BuildHeader() Next Next End If
这是我最开始放的地方,可是启动项目的时候总报错
|
-- 作者:lin_hailun
-- 发布时间:2013/2/5 14:32:00
--
With DataTables("产品信息") Dim nmms() As String ={"电雕在制支数","机加在制支数","镀铜在制支数","车研在制支数","镀铬在制支数","料库在制支数","打样在制支数","印前在制支数","总检在制支数"} Dim nms() As String = {"电雕在制明细","机加在制明细","镀铜在制明细","车研在制明细","镀铬在制明细","料库在制明细","打样在制明细","印前在制明细","总检在制明细"} If _UserGroup <> "生产部" Then For Each nmm As String In nmms .DataCols(nmm).Caption = "在制支数" Next For Each nm As String In nms .DataCols(nm).Caption = "明细" Next Else
For Each nmm As String In nmms .DataCols(nmm).Caption = Nothing Next For Each nm As String In nms .DataCols(nm).Caption = Nothing Next End If .BuildHeader() End With
|