向下按下C#窗口时,组合框自动完成空白 [英] Combo box autocomplete blanks when down key pressed C# windows

查看:92
本文介绍了向下按下C#窗口时,组合框自动完成空白的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在组合框列表中选择项目时,用户可以开始键入名称的前几个字母,组合框会相应地缩小选择范围。它还显示了可能与用户选择匹配的项目的另一个下拉菜单。 (建议自动完成功能)

如果用户使用箭头键向下移动建议列表然后按下键; (确定建议选择的逻辑性事项),选择组合框内的文本而不是选中的项目。



任何想法如何禁用关键工作在组合框的下拉列表中?





查看此图片的链接 https://onedrive.live.com/redir?resid=908945FCED33300B! 106& authkey =!AFgp787Zo7CZTnI& v = 3& ithint = photo%2cpng [ ^ ]

此处结果显示在自动完成建议中。

我在组合框下拉列表中按下键记录选择

而不是自动完成建议。

When selecting an item in the combobox list, the user can start typing the first few letters of the name and the combobox narrows the selection accordingly. It also shows another drop down menu of items that may match the user's selection. (suggest feature of autocomplete)
if the user uses the arrow keys to move down the suggested list then presses down key; (the logical thing to do to confirm a suggested selection), the text inside the combo box selected rather than the selected item.

any idea how to disable down key working in dropdownlist of combo box?


view this image link https://onedrive.live.com/redir?resid=908945FCED33300B!106&authkey=!AFgp787Zo7CZTnI&v=3&ithint=photo%2cpng[^]
here result is shown in auto-complete suggestion.when
I press down key record in combo box dropdown list selected
rather than the auto-complete suggestion.

推荐答案

使用onkeydown活动



Use onkeydown event

<asp:DropDownList ID="DropDownList1" runat="server" onkeydown="return false;">
            <asp:ListItem>a</asp:ListItem>
            <asp:ListItem>b</asp:ListItem>
            <asp:ListItem>c</asp:ListItem>
        </asp:DropDownList>




C#windows应用程序






in C# windows Application

private void comboBox1_KeyDown(object sender, KeyEventArgs e)
        {
            e.Handled = true;
        }


这篇关于向下按下C#窗口时,组合框自动完成空白的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆