我想以过滤项的ListView
为用户键入文本框
和我的列表使用的KeyDown
和键preSS
事件,但是当我读 textbox.Text
,它总是返回前的最后一个键preSS的文本。有没有一种方法总是得到任何显示在文本框
无pressing进入?
I am trying to filter a list of items in a ListView
as the user types into a TextBox
and I use KeyDown
, and KeyPress
events but when I read the textbox.Text
, it always returns the text before the last key press. Is there a way to always get whatever is shown in the TextBox
without pressing enter?
使用的 TextBox.TextChanged
事件(从控制
继承)。
时发生的Text属性值的变化。
Occurs when the Text property value changes.
我的建议是尽量不要与关键事件破解这个(下/ preSS /上) - 还有其他的方法来改变文本框的文字,如通过从右键单击上下文粘贴文本菜单。这不涉及pressing的关键。
My advice is to try not to hack this with the key events (down / press / up) - there are other ways to change a text-box's text, such as by pasting text from the right-click context menu. This doesn't involve pressing a key.