以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助] 未设置对象变量或 With 块变量 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=133782) |
-- 作者:YOU -- 发布时间:2019/4/20 10:39:00 -- [求助] 未设置对象变量或 With 块变量 .NET Framework 版本:2.0.50727.9035 Foxtable 版本:2017.12.18.1 错误所在事件:项目,AfterOpenProject 详细错误信息: 未设置对象变量或 With 块变量。 Dim MainTab As C1Command.C1DockingTab = BaseMainform.Controls("MainPages") MainTab.HotTrack = True MainTab.CanCloseTabs = True MainTab.Font = New Font("微软雅黑",10) BaseMainForm.Text = "主界面后台" ShowCloseButton = False For Each t As Table In Tables If t.TableType = TableTypeEnum.Normal AndAlso t.IsCopy = False Then Dim s As String If t.DataTable.Caption > "" Then s = t.DataTable.Caption Else s = t.Name End If If s.Length > 10 Then s = Left(s,10) End If Dim str As New String(" ",12 - s.Length) If t.Name <> "主界面" Then Dim tb As Object = MainTab.Controls(t.Name) tb.Text = s & str & "x" End If t.DataTable.SysStyles("EmptyArea").BackColor = Color.White End If Next Forms("导航栏").Show Forms("主界面").Show MainTable = Tables("主界面") |
-- 作者:有点蓝 -- 发布时间:2019/4/20 11:06:00 -- 调试技巧:http://www.foxtable.com/webhelp/scr/1485.htm,看看哪一句代码有问题 |
-- 作者:YOU -- 发布时间:2019/4/20 11:15:00 -- 好像是红色部分的问题,不知道怎么处理 Dim MainTab As C1Command.C1DockingTab = BaseMainform.Controls("MainPages") MainTab.HotTrack = True MainTab.CanCloseTabs = True MainTab.Font = New Font("微软雅黑",10) BaseMainForm.Text = "主界面后台" ShowCloseButton = False For Each t As Table In Tables If t.TableType = TableTypeEnum.Normal AndAlso t.IsCopy = False Then Dim s As String If t.DataTable.Caption > "" Then s = t.DataTable.Caption Else s = t.Name End If If s.Length > 10 Then s = Left(s,10) End If Dim str As New String(" ",12 - s.Length) If t.Name <> "主界面" Then Dim tb As Object = MainTab.Controls(t.Name) tb.Text = s & str & "x" End If t.DataTable.SysStyles("EmptyArea").BackColor = Color.White End If Next Forms("导航栏").Show Forms("主界面").Show MainTable = Tables("主界面")
|
-- 作者:有点蓝 -- 发布时间:2019/4/20 11:24:00 -- If s > "" andalso s.Length > 10 Then s = Left(s,10) End If
|
-- 作者:YOU -- 发布时间:2019/4/20 11:27:00 -- 还是有问题 Dim MainTab As C1Command.C1DockingTab = BaseMainform.Controls("MainPages") MainTab.HotTrack = True MainTab.CanCloseTabs = True MainTab.Font = New Font("微软雅黑",10) BaseMainForm.Text = "主界面后台" ShowCloseButton = False For Each t As Table In Tables If t.TableType = TableTypeEnum.Normal AndAlso t.IsCopy = False Then Dim s As String If t.DataTable.Caption > "" Then s = t.DataTable.Caption Else s = t.Name End If If s.Length > 10 Then s = Left(s,10) End If Dim str As New String(" ",12 - s.Length) If t.Name <> "主界面" Then Dim tb As Object = MainTab.Controls(t.Name) tb.Text = s & str & "x" End If t.DataTable.SysStyles("EmptyArea").BackColor = Color.White End If Next Forms("导航栏").Show Forms("主界面").Show MainTable = Tables("主界面")
|
-- 作者:有点蓝 -- 发布时间:2019/4/20 11:53:00 -- MainTab.Controls(t.Name),没有这个名称的控件就会出错。 \'自己看看都有什么名称 for each o as object in MainTab.Controls msgbox(o.name) next
|
-- 作者:YOU -- 发布时间:2019/4/20 14:12:00 -- 好像有关联表的就报错了 |
-- 作者:有点蓝 -- 发布时间:2019/4/20 15:06:00 -- 那就排除掉关联表 |
-- 作者:YOU -- 发布时间:2019/4/20 16:09:00 -- 怎么排除关联表? |
-- 作者:有点蓝 -- 发布时间:2019/4/20 17:06:00 -- if t.name.contains(".") then msgbox("是关联表") end if
|