C# and IME - getting the current input text
I'm using the Japanese IME as an example but it is probably the same in other languages which use an IME for input. When the user types text into a textbox using the IME, the KeyDown and KeyUp events are fired. However the TextBox.Text property does not return the typed text until the user has validated the input in the IME using the Enter key. So for example if the user types 5 times あ then validates, I will get 5 keydown/keyup events, with each time TextBox.Text returning "" (the empty string) and at the end I will get a keydown/keyup for the enter key and the TextBox.Text will directly