以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]自定义函数问题  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=78363)

--  作者:cqlwsam
--  发布时间:2015/12/8 8:26:00
--  [求助]自定义函数问题
在项目中自定义函数(控件控制),运行提醒错误,提示如截图。


图片点击可在新窗口打开查看此主题相关图片如下:360反馈意见截图16720406106126102.png
图片点击可在新窗口打开查看

自定义函数代码如下:

Dim FTB As WinForm.Table= Args(0)
Dim frm As WinForm.Form=args(1)
Dim tb As Table = FTB.Table
\'Dim frm As  f
If tb.count=0 Then
    For Each c As WinForm.Control In frm.Controls
        If Typeof c Is winform.button Then
            c.Enabled=False
        End If
    Next
    frm.controls("Btn_add").Enabled=True
Else If tb.count=1 Then
    For Each c As WinForm.Control In frm.Controls
        If Typeof c Is winform.button Then
            c.Enabled=False
        End If
    Next
    frm.Controls("Btn_edit").Enabled=True
    frm.Controls("Btn_delete").Enabled=True
    frm.controls("Btn_add").Enabled=True
Else If tb.count>1 AndAlso tb.position=tb.count-1 Then
    For Each c As WinForm.Control In frm.Controls
        If Typeof c Is winform.button Then
            c.Enabled=True
        End If
    Next
    frm.Controls("Btn_last").enabled=False
    frm.Controls("Btn_next").enabled=False
    Frm.Controls("Btn_ok").enabled=False
    frm.Controls("Btn_cancel").enabled=False
Else If tb.count>1 AndAlso tb.position=0 Then
    For Each c As WinForm.Control In frm.Controls
        If Typeof c Is winform.button Then
            c.Enabled=True
        End If
    Next
    frm.Controls("Btn_first").enabled=False
    frm.Controls("Btn_pre").enabled=False
    frm.Controls("Btn_ok").enabled=False
    frm.Controls("Btn_cancel").enabled=False
Else
   For Each c As WinForm.Control In frm.Controls
       If Typeof c Is winform.button Then
           c.Enabled=True
       End If
   Next
   frm.Controls("Btn_ok").enabled=False
   frm.Controls("Btn_cancel").enabled=False
End If


--  作者:Hyphen
--  发布时间:2015/12/8 8:47:00
--  
代码没有问题,问题出在调用的地方,传入了不正确的参数
--  作者:大红袍
--  发布时间:2015/12/8 9:13:00
--  

你传递的是字符吧?

 

 

[此贴子已经被作者于2015/12/8 9:13:13编辑过]

--  作者:cqlwsam
--  发布时间:2015/12/8 11:39:00
--  
第一个传递的是表名,第二个是窗口名。
--  作者:大红袍
--  发布时间:2015/12/8 11:41:00
--  
Dim FTB As WinForm.Table= Args(0)
Dim frm As WinForm.Form=args(1)
Dim tb As Table = FTB.Table

 

改成

 

Dim frm As WinForm.Form = Forms(args(1))
Dim tb As Table = Tables(Args(0))

--  作者:cqlwsam
--  发布时间:2015/12/8 11:45:00
--  
代码:
tables(“基本信息_table1”).allowedit=false
functions.execute("控件控制","基本情况_table1", “基本信息”)

--  作者:大红袍
--  发布时间:2015/12/8 11:48:00
--  
看5楼。