以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  关于KeyDownEdit事件代码  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=57273)

--  作者:ap9709130
--  发布时间:2014/9/22 11:45:00
--  关于KeyDownEdit事件代码

我的代码发下:

If e.Col.name = "产品名称" Then
    If e.KeyCode = Keys.Enter Then
        Dim s As String  = DataTables("物料信息表").SQLGetComboListString("产品名称","产品名称 like \'%" & e.text & "%\'")
        e.Col.ComboList = s
        If e.Col.DroppedDown = False \'且下来列表没有打开
            e.Col.OpenDropDown() \'打开下拉列表
        End If
    End If
End If

 

s的值是对的,但为什么下拉列表打不开,要怎么样才能让下拉列表打开呢?


--  作者:Bin
--  发布时间:2014/9/22 11:55:00
--  
不要使用回车键, 换一个键 或者使用组合键 例如CTRL+回车



--  作者:有点甜
--  发布时间:2014/9/22 11:59:00
--  

试试这样

 

If e.Col.name = "产品名称" Then
    If e.KeyCode = Keys.Enter Then

        e.Cancel = True
        Dim s As String  = DataTables("物料信息表").SQLGetComboListString("产品名称","产品名称 like \'%" & e.text & "%\'")
        e.Col.ComboList = s
        If e.Col.DroppedDown = False \'且下来列表没有打开
            e.Col.OpenDropDown() \'打开下拉列表
        End If
    End If
End If


--  作者:有点甜
--  发布时间:2014/9/22 12:02:00
--  

再试试这个

 

If e.Col.name = "产品名称" Then
    If e.KeyCode = Keys.Enter Then

        e.Cancel = True
        Dim s As String  = DataTables("物料信息表").SQLGetComboListString("产品名称","产品名称 like \'%" & e.text & "%\'")
        e.Col.ComboList = s

        Sendkeys.Send("{F4}")
    End If
End If

 


--  作者:lsy
--  发布时间:2014/9/22 14:20:00
--  

PrepareEdit

If e.Col.name = "产品名称" AndAlso e.IsFocusCell Then     
     e.Col.ComboList = DataTables("物料信息表").SQLGetComboListString("产品名称","产品名称 like \'%" & e.text & "%\'")
           
End If

 

进入单元格后,连按两次空格键,就打开了下拉框。