Foxtable(狐表)用户栏目专家坐堂 → 内部函数无法执行的问题


  共有1551人关注过本帖树形打印复制链接

主题:内部函数无法执行的问题

帅哥哟,离线,有人找我吗?
HANZHIGANG
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:一尾狐 帖子:410 积分:4455 威望:0 精华:0 注册:2015/3/21 14:25:00
内部函数无法执行的问题  发帖心情 Post By:2023/5/11 12:12:00 [只看该作者]

全局代码中代码
Public Filter As String

内部函数中代码
If Filter > "" Then
    Tables(Maintable.Name).DataTable.loadfilter = Filter
    Tables(Maintable.Name).DataTable.load
Else
    Tables(Maintable.Name).DataTable.loadfilter = ""
    Tables(Maintable.Name).DataTable.load
End If
Forms ("导航窗口").Controls("TextBox1").Value = 1 & "/" & Tables(Maintable.Name).DataTable.TotalPages

窗口中全局事件Click代码
With e.Form.Controls("上游客户")
    If .text > "" Then
        Filter = "上游客户 like '%" & .text & "%'"
    End If
End With

With e.Form.Controls("品牌")
    If .text > "" Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "品牌 like '%" & .text & "%'"
    End If
End With

With e.Form.Controls("商品车")
    If .text > "" Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "商品车 like '%" & .text & "%'"
    End If
End With

With e.Form.Controls("备注")
    If .text > "" Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "备注 like '%" & .text & "%'"
    End If
End With


Select Case e.Sender.Name
    Case "查询" 
        Functions.Execute("查询")
        
    Case "清除"
        Functions.Execute("清除", e) '清除窗口查询条件
End Select

第一次执行查询按钮,是没有问题的,可以按条件加载数据。
但是如果击清除按钮后,再点击查询,就没有反应了
老师帮分析一下原因,及解决的办法



 回到顶部
帅哥哟,离线,有人找我吗?
HANZHIGANG
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:一尾狐 帖子:410 积分:4455 威望:0 精华:0 注册:2015/3/21 14:25:00
  发帖心情 Post By:2023/5/11 12:14:00 [只看该作者]

清除的内部函数代码如下
Dim e = args(0)
For Each c As WinForm.Control In e.Form.Controls
    If TypeOf c Is WinForm.TextBox Then '判断控件是否是文本框
        Dim t As WinForm.TextBox = c '使用特定类型的变量引用控件
        t.Text = ""
    End If
Next

For Each c1 As WinForm.Control In e.Form.Controls
    If TypeOf c1 Is WinForm.ComboBox Then '判断控件是否是文本框
        Dim t1 As WinForm.ComboBox = c1 '使用特定类型的变量引用控件
        t1.Text = ""
    End If
Next

For Each c2 As WinForm.Control In e.Form.Controls
    If TypeOf c2 Is WinForm.DateTimePicker Then '判断控件是否是文本框
        Dim t2 As WinForm.DateTimePicker = c2 '使用特定类型的变量引用控件
        t2.text = ""
    End If
Next

 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:106132 积分:539771 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2023/5/11 13:35:00 [只看该作者]

调试

内部函数中代码
msgbox(Filter)
If Filter > "" Then
    Tables(Maintable.Name).DataTable.loadfilter = Filter
……

窗口中全局事件Click代码
……
Select Case e.Sender.Name
    Case "查询" 
msgbox(1)
        Functions.Execute("查询")
        
    Case "清除"
msgbox(2)
        Functions.Execute("清除", e) '清除窗口查询条件
End Select

 回到顶部