代码之家  ›  专栏  ›  技术社区  ›  user247702

.NET ComboBoxStyle.DropDownList selecting while typing

  •  1
  • user247702  · 技术社区  · 14 年前

    I have a ComboBox with a list of names. I don't want to allow new values, so I set the DropDownStyle to DropDownList.

    键入以选择名称时,只允许输入一个字母。所以如果我输入“t”,它会跳到以“t”开头的名字。如果我输入“o”,它不会跳到以“to”开头的第一个项目,而是跳到以“o”开头的第一个项目。

    有没有办法改变这种行为?或者使用当前的DropDownStyle,或者使用其他DropDownStyle,将其限制为现有值。

    1 回复  |  直到 14 年前
        1
  •  2
  •   lc.    14 年前

    设置 AutoCompleteSource Items 然后设置 AutoCompleteMode . SuggestAppend is probably what you're looking for, but you can play with the others and choose which one you like.