以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- combobox变成了暗灰色,不能筛选 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=73489) |
-- 作者:阿福 -- 发布时间:2015/8/20 10:33:00 -- combobox变成了暗灰色,不能筛选 老师你好, 我新建了一个窗口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("饲料品牌") |
-- 作者:大红袍 -- 发布时间:2015/8/20 11:08:00 -- 1、控件不要绑定表列;
2、去看控件的ValueChanged事件是否写了什么代码;
3、如果不控制不可用,是不会变灰的 |
-- 作者:阿福 -- 发布时间:2015/8/20 11:11:00 -- 谢谢大红袍老师,原来我是绑定表列了! |
-- 作者:阿福 -- 发布时间: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 & "\' " 以上的筛选条件就不能用了?该怎么改? |
-- 作者:大红袍 -- 发布时间:2015/8/20 11:33:00 -- 不要这样设置筛选。
参考这样的代码编写:
http://www.foxtable.com/help/topics/1058.htm
|