以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 请教高手关于CurrentChanged的问题 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=58936) |
||||
-- 作者:audience68 -- 发布时间:2014/10/26 23:17:00 -- 请教高手关于CurrentChanged的问题 想要在CurrentChanged中写一段代码,要实现根据不同行是否被审核而确定文件管理器中调整增加或删除的权限,可是下面的语句总是出错,请高手指教。语句和出错内容如下: If Forms("监造周报窗口").Opened Then Dim fm1 As
WinForm.FileManager
= e.Form.Controls("FileManager1") Dim fm2 As
WinForm.FileManager
= e.Form.Controls("FileManager2") Dim fm3 As WinForm.FileManager
= e.Form.Controls("FileManager3") Dim fm As WinForm.PictureViewer
= e.Form.Controls("PictureViewer1") If Tables("监造周报").Current("审核")
IsNot Nothing Then \'如果周报已经审批 fm1.AddCommand.Visible = False fm2.AddCommand.Visible = False fm3.AddCommand.Visible = False fm.AddCommand.Visible = False fm1.DeleteCommand.Visible = False fm2.DeleteCommand.Visible = False fm3.DeleteCommand.Visible = False fm.DeleteCommand.Visible = False fm1.ClearCommand.Visible = False fm2.ClearCommand.Visible = False fm3.ClearCommand.Visible = False fm.ClearCommand.Visible = False Else fm1.AddCommand.Visible = True fm2.AddCommand.Visible = True fm3.AddCommand.Visible = True fm.AddCommand.Visible = True fm1.DeleteCommand.Visible = True fm2.DeleteCommand.Visible = True fm3.DeleteCommand.Visible = True fm.DeleteCommand.Visible = True End If End If .NET Framework 版本:2.0.50727.5485 Foxtable 版本:2014.10.16.1 错误所在事件:监造周报,CurrentChanged 详细错误信息: 未将对象引用设置到对象的实例。 |
||||
-- 作者:有点甜 -- 发布时间:2014/10/26 23:25:00 -- e.Form 改成 Forms("监造周报窗口") |
||||
-- 作者:有点甜 -- 发布时间:2014/10/26 23:26:00 -- 第二点:判断一下 If e.Table.Current IsNot Nothing Then |
||||
-- 作者:audience68 -- 发布时间:2014/10/27 7:44:00 -- 甜版,修改后不报错了,但是点击所有行都是FALSE状态,对于没有审核的,并不能实现TRUE,不知是何原因。修改后的代码如下: If Forms("监造周报窗口").Opened Then If e.Table.Current IsNot Nothing Then Dim fm1 As WinForm.FileManager
= Forms("监造周报窗口").Controls("FileManager1") Dim fm2 As WinForm.FileManager
= Forms("监造周报窗口").Controls("FileManager2") Dim fm3 As WinForm.FileManager
= Forms("监造周报窗口").Controls("FileManager3") Dim fm As WinForm.PictureViewer
= Forms("监造周报窗口").Controls("PictureViewer1") If Tables("监造周报").Current("审核")
IsNot Nothing Then \'如果周报已经审批 fm1.AddCommand.Visible
= False fm2.AddCommand.Visible = False fm3.AddCommand.Visible = False fm.AddCommand.Visible = False fm1.DeleteCommand.Visible = False fm2.DeleteCommand.Visible = False fm3.DeleteCommand.Visible = False fm.DeleteCommand.Visible = False fm1.ClearCommand.Visible = False fm2.ClearCommand.Visible = False fm3.ClearCommand.Visible = False fm.ClearCommand.Visible = False Else fm1.AddCommand.Visible = True fm2.AddCommand.Visible = True fm3.AddCommand.Visible = True fm.AddCommand.Visible = True fm1.DeleteCommand.Visible = True fm2.DeleteCommand.Visible = True fm3.DeleteCommand.Visible = True fm.DeleteCommand.Visible = True End If End If End If |
||||
-- 作者:逛逛 -- 发布时间:2014/10/27 7:57:00 -- 你的审核列 没有为空的
如果是逻辑列,改成 If Not Tables("监造周报").Current("审核") Then
试试 |
||||
-- 作者:audience68 -- 发布时间:2014/10/27 8:28:00 -- 谢谢,不是逻辑列,审核列是填入审核人名字,如果有名字就是审核,没有名字就未审核。 |
||||
-- 作者:Bin -- 发布时间:2014/10/27 8:31:00 -- If Not Tables("监造周报").Current.isnull("审核") then |
||||
-- 作者:audience68 -- 发布时间:2014/10/27 8:33:00 -- 甜版,我又做了一个例子,希望在窗口中实现,点击周报表的不同行,根据审核列中不同的审核情况,调整窗口中FileManager和PictureViewer中编辑权限,如果审批状态,就取消增加权限,如果未审批,就保持原来的状态(就是可以增加)。 麻烦甜版指导,谢谢
|
||||
-- 作者:有点甜 -- 发布时间:2014/10/27 9:23:00 -- If Forms("周报").Opened Then If e.Table.Current IsNot Nothing Then Dim fm1 As WinForm.FileManager = Forms("周报").Controls("FileManager1") \'Dim fm2 As WinForm.FileManager = Forms("周报").Controls("FileManager2") \'Dim fm3 As WinForm.FileManager = Forms("周报").Controls("FileManager3") Dim fm As WinForm.PictureViewer = Forms("周报").Controls("PictureViewer1") If e.Table.Current.IsNull("审核") = False Then \'如果周报已经审批 fm1.AddCommand.Visible = False \'fm2.AddCommand.Visible = False \'fm3.AddCommand.Visible = False fm.AddCommand.Visible = False fm1.DeleteCommand.Visible = False \' fm2.DeleteCommand.Visible = False \'m3.DeleteCommand.Visible = False fm.DeleteCommand.Visible = False fm1.ClearCommand.Visible = False \' fm2.ClearCommand.Visible = False \' fm3.ClearCommand.Visible = False fm.ClearCommand.Visible = False Else fm1.AddCommand.Visible = True \' fm2.AddCommand.Visible = True \' fm3.AddCommand.Visible = True fm.AddCommand.Visible = True fm1.DeleteCommand.Visible = True \' fm2.DeleteCommand.Visible = True \' fm3.DeleteCommand.Visible = True fm.DeleteCommand.Visible = True End If End If End If |
||||
-- 作者:audience68 -- 发布时间:2014/10/27 11:16:00 -- ok,谢谢甜版 修改了一下,在窗口的afterload中也维护了一套判断代码
|