I’m trying to write a page that filters a ListBox depending on the contents of the textbox. I’ve got all the other stuff working but I want the ListBox to apply the filter with every KeyDown event that occurs in the TextBox. The problem is, when I capture the KeyDown event and then try to look at the TextBox.Text property, it remains empty. I imagine that this is due to the fact that the TextBox may only update the Text property when it loses focus.
Any thoughts on how I can get the current text in a TextBox during the KeyDown event without having to capture and rebuild the character array during each KeyDown?
Thanks!
Manual:
In the KeyDown event, you can capture the key that’s pressed:
After the event exits, the pressed key is added to the
.Textproperty, so the next time the KeyDown event is raised, you can read the previously entered characters from.Text.