Foxtable(狐表)用户栏目专家坐堂 → combobox变成了暗灰色,不能筛选


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

主题:combobox变成了暗灰色,不能筛选

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


加好友 发短信
等级:幼狐 帖子:196 积分:1357 威望:0 精华:0 注册:2015/3/25 16:42:00
combobox变成了暗灰色,不能筛选  发帖心情 Post By:2015/8/20 10:33:00 [只看该作者]

老师你好,
我新建了一个窗口forms(“饲料消耗-查找”),button(“确定”),button(“消除”)还有其他的combobox控件
forms(“饲料消耗-查找”)的afterload事件为:
 Dim ksrq As WinForm.DateTimePicker = e.Form.Controls("开始日期")
Dim jsrq As WinForm.DateTimePicker = e.Form.Controls("结束日期")
Dim ds As WinForm.ComboBox = e.Form.Controls("栋舍")
Dim zzlx As WinForm.ComboBox = e.Form.Controls("猪只类型")
Dim slzl As WinForm.ComboBox = e.Form.Controls("饲料种类")
Dim sllx As WinForm.ComboBox = e.Form.Controls("饲料类型")
Dim slpp As WinForm.ComboBox = e.Form.Controls("饲料品牌")
ds.ComboList = DataTables("猪舍设置").GetComboListString("栋舍名称")
zzlx.ComboList = DataTables("猪只类型").GetComboListString("类型名称")
slzl.ComboList = DataTables("饲料种类").GetComboListString("饲料种类")
sllx.ComboList = DataTables("饲料类型").GetComboListString("饲料类型")
slpp.ComboList = DataTables("饲料供应商信息").GetComboListString("公司品牌")

button(“确定”)的click事件:
Dim jsrq As WinForm.DateTimePicker = e.Form.Controls("结束日期")
Dim ksrq As WinForm.DateTimePicker = e.Form.Controls("开始日期")
Dim ds As WinForm.ComboBox = e.Form.Controls("栋舍")
Dim zzlx As WinForm.ComboBox = e.Form.Controls("猪只类型")
Dim slzl As WinForm.ComboBox = e.Form.Controls("饲料种类")
Dim sllx As WinForm.ComboBox = e.Form.Controls("饲料类型")
Dim slpp As WinForm.ComboBox = e.Form.Controls("饲料品牌")
Dim jsrq1 As Date = jsrq.Value
Dim ksrq1 As Date = ksrq.Value
Dim ds1 As String = ds.Value
Dim zzlx1 As String = zzlx.Value
Dim slzl1 As String = slzl.Value
Dim sllx1 As String = sllx.Value
Dim slpp1 As String = slpp.Value
Dim f As String = "[日期] >= '" & ksrq1 & "' and [日期]< ='" & jsrq1 & "' and [sys_user] = '" & user.Name & "' and [栋舍] ='" & ds1 & "' and [猪只类型] ='" & zzlx1 & "' and [饲料_种类] ='" & slzl1 & "' and [饲料_类型] ='" & sllx1 & "' and [饲料_品牌] ='" & slpp1 & "'  "
DataTables("饲料消耗").LoadOrder = "日期"
DataTables("饲料消耗").LoadTop = "14"
DataTables("饲料消耗").LoadPage = "0"
DataTables("饲料消耗").LoadFilter = f
DataTables("饲料消耗").load()
Dim ys As WinForm.Label = Forms("饲料消耗").Controls("页数")
Dim ys1 As WinForm.Label = Forms("饲料消耗").Controls("页数1")
Dim a As Integer = DataTables("饲料消耗").TotalPages
If a > 0 Then
ys1.Text = "第" & "1" & "页"
ys.Text = "共" & a &  "页" & ","
Else
ys1.Text = "第" & "0" & "页"
ys.Text = "共" & "0" &  "页" & ","
End If

button(“消除”)的click事件:
Dim jsrq As WinForm.DateTimePicker = e.Form.Controls("结束日期")
Dim ksrq As WinForm.DateTimePicker = e.Form.Controls("开始日期")
Dim ds As WinForm.ComboBox = e.Form.Controls("栋舍")
Dim zzlx As WinForm.ComboBox = e.Form.Controls("猪只类型")
Dim slzl As WinForm.ComboBox = e.Form.Controls("饲料种类")
Dim sllx As WinForm.ComboBox = e.Form.Controls("饲料类型")
Dim slpp As WinForm.ComboBox = e.Form.Controls("饲料品牌")
jsrq.Value = Nothing
ksrq.Value = Nothing
ds.Value = Nothing
zzlx.Value = Nothing 
slzl.Value = Nothing
sllx.Value = Nothing
slpp.Value = Nothing

打开窗口,点击了以下button(“消除”),后以下控件变成暗灰色,不能再筛选,老师怎么解决?
e.Form.Controls("开始日期")
e.Form.Controls("结束日期")
e.Form.Controls("栋舍")
e.Form.Controls("猪只类型")
e.Form.Controls("饲料种类")
e.Form.Controls("饲料类型")
e.Form.Controls("饲料品牌")

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


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/8/20 11:08:00 [只看该作者]

1、控件不要绑定表列;

 

2、去看控件的ValueChanged事件是否写了什么代码;

 

3、如果不控制不可用,是不会变灰的


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


加好友 发短信
等级:幼狐 帖子:196 积分:1357 威望:0 精华:0 注册:2015/3/25 16:42:00
  发帖心情 Post By:2015/8/20 11:11:00 [只看该作者]

谢谢大红袍老师,原来我是绑定表列了!

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


加好友 发短信
等级:幼狐 帖子:196 积分:1357 威望:0 精华:0 注册:2015/3/25 16:42:00
  发帖心情 Post By:2015/8/20 11:17:00 [只看该作者]

大红袍老师,如果我只设置“开始日期”,“结束日期”,“饲料品牌”,按了确定按钮,但好像筛选不了,是不是其他筛选条件为空时,
Dim f As String = "[日期] >= '" & ksrq1 & "' and [日期]< ='" & jsrq1 & "' and [sys_user] = '" & user.Name & "' and [栋舍] ='" & ds1 & "' and [猪只类型] ='" & zzlx1 & "' and [饲料_种类] ='" & slzl1 & "' and [饲料_类型] ='" & sllx1 & "' and [饲料_品牌] ='" & slpp1 & "'  "
以上的筛选条件就不能用了?该怎么改?


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


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/8/20 11:33:00 [只看该作者]

 不要这样设置筛选。

 

 参考这样的代码编写:

 

http://www.foxtable.com/help/topics/1058.htm

 


 回到顶部