以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 怎样用代码展开下拉框 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=53199) |
-- 作者:老头 -- 发布时间:2014/7/2 10:27:00 -- 怎样用代码展开下拉框 比如, combobox: listbox: DateTimePicker: |
-- 作者:有点甜 -- 发布时间:2014/7/2 10:28:00 -- 呃,好像不行。只能是模拟按下F4
Sendkeys.Send("{F4}") |
-- 作者:老头 -- 发布时间:2014/7/2 10:37:00 -- 我是想,下拉选一个条件后,自动展开日期这个控件。
Dim Dt1 As WinForm.DateTimePicker = e.Form.Controls("DateTimePicker1") dt1.Select
这样不行,应该怎么改呢
|
-- 作者:Bin -- 发布时间:2014/7/2 10:40:00 -- 我复制你的代码,测试是可以的哦. 你是否写错了事件. 可以放到Textchanged事件去
|
-- 作者:老头 -- 发布时间:2014/7/2 10:41:00 -- 我在是combobox 的 SelectedIndexChanged 里写的 |
-- 作者:Bin -- 发布时间:2014/7/2 10:41:00 -- 看4楼 |
-- 作者:有点甜 -- 发布时间:2014/7/2 10:45:00 -- 以下是引用老头在2014-7-2 10:41:00的发言:
我在是combobox 的 SelectedIndexChanged 里写的
测试了一下,在SelectIndexChanged等事件不行,你再测试其他事件。
再不行,最好放在日期控件的Enter事件里去。 |
-- 作者:狐狸爸爸 -- 发布时间:2014/7/2 10:55:00 -- Dim cmb As WinForm.ComboBox = e.Form.Controls("ComboBox1") cmb.OpenDropDown |
-- 作者:Bin -- 发布时间:2014/7/2 10:57:00 -- 以下是引用狐狸爸爸在2014-7-2 10:55:00的发言:
楼主用的是DateTimePicker 没办法这样做.
Dim cmb As WinForm.ComboBox = e.Form.Controls("ComboBox1") cmb.OpenDropDown |