师傅 我在
AfterOpenProject 里 写入如下代码后, 当登录 “用户登录”后 进入系统 出现的是新建页面 而不是 我想要的 主页?
此主题相关图片如下:1an@ove1pv6p0yhje@7`9px.jpg
此主题相关图片如下:%{la0vt4g4olzv2((o)td{0.jpg
当我把 新建 这个表名 改成 新建分类等其他名字是 登录的时候出现 “不存在名称为“新建”的Table!”
错误代码位置:项目,AfterOpenProject
System.NullReferenceException: Object reference not set to an instance of an object.
at UserCode.AfterOpenProject()
---------------------------
确定
---------------------------
您能帮我看看吗?谢谢您!
代码
For Each t As Table In Tables
t.Visible = False
For Each c As Col In t.Cols
c.Visible = False
c.AllowEdit = False
Next
Next
Forms("用户登录").Show()
Forms("主桌面").open
Dim roles() As String = _userGroup.Split(",")
For Each role As String In roles
Dim drs As List(Of DataRow) = DataTables("权限").Select("可见 = '" & role & "' or 可见 like '" & role & ",*' or 可见 like '*," & role & ",*' Or 可见 like '*," & role & "'")
For Each dr As DataRow In drs
If dr.Isnull("表名") AndAlso dr.Isnull("列名") Then
For Each t As Table In Tables
t.Visible = True
Next
Else If dr.isnull("列名") Then
Tables(dr("表名")).Visible = True
For Each c As Col In Tables(dr("表名")).Cols
c.Visible = True
Next
Else
Tables(dr("表名")).Visible = True
For Each c As Col In Tables(dr("表名")).Cols
If dr("列名") = c.name OrElse dr("列名") Like c.name & ",*" OrElse dr("列名") Like "*," & c.name & ",*" OrElse dr("列名") Like "*," & c.name Then
c.Visible = True
End If
Next
End If
Next
drs = DataTables("权限").Select("可编辑 = '" & role & "' or 可编辑 like '" & role & ",*' or 可编辑 like '*," & role & ",*' Or 可编辑 like '*," & role & "'")
For Each dr As DataRow In drs
If dr.Isnull("表名") AndAlso dr.Isnull("列名") Then
For Each t As Table In Tables
t.Visible = True
t.AllowEdit = True
Next
Else If dr.isnull("列名") Then
Tables(dr("表名")).Visible = True
For Each c As Col In Tables(dr("表名")).Cols
c.Visible = True
c.AllowEdit = True
Next
Else
Tables(dr("表名")).Visible = True
For Each c As Col In Tables(dr("表名")).Cols
If dr("列名") = c.name OrElse dr("列名") Like c.name & ",*" OrElse dr("列名") Like "*," & c.name & ",*" OrElse dr("列名") Like "*," & c.name Then
c.Visible = True
c.AllowEdit = True
End If
Next
End If
Next
Next
[此贴子已经被作者于2013-6-18 16:08:05编辑过]