Seems like this should be doable, but I'm having no luck -
I have an Array of buttons with Japanese kana characters to act as a user input. Pressing a button (using a mouse) raises an event with the character as the data. My thought was just to use the same handler as the textbox key events, but no luck...
I've tried to call the TextBox_KeyUp/DOWN/Press events directly by creating a new "e As System.Windows.Forms.KeyEventArgs" and then passing this to the TextBox_KeyDown(TextBox,e) method.
Stepping through the code shows that the data IS passed, but no character is placed in the textbox - it remains blank, yet pressing a keyboard key enters text fine.
How come?
So briefly:
in the button pressed event:
Dim e as new e As System.Windows.Forms.KeyEventArgs("ぬ") 'set the character in to the keydata for the event argument
TextBox_KeyDown(TextBox, e) call the textbox keydown method - key data passed and fires event - no text.
I've tried for all three events, KeyUp,Down and Press, same result.
I have a workaround using the Textbox.Text and SelectionStart, etc., but I'm just looking for a more elegant solution - I would like the user to be able to click on a button for Japanese, but ALSO use the keyboard for TYPING English and not have to worry about where the cursor is, but because of special keys like Backspace, etc. this starts to involve checking a lot of key data unnecessarily...
Any thoughts appreciated...
Carp
I have an Array of buttons with Japanese kana characters to act as a user input. Pressing a button (using a mouse) raises an event with the character as the data. My thought was just to use the same handler as the textbox key events, but no luck...
I've tried to call the TextBox_KeyUp/DOWN/Press events directly by creating a new "e As System.Windows.Forms.KeyEventArgs" and then passing this to the TextBox_KeyDown(TextBox,e) method.
Stepping through the code shows that the data IS passed, but no character is placed in the textbox - it remains blank, yet pressing a keyboard key enters text fine.
How come?
So briefly:
in the button pressed event:
Dim e as new e As System.Windows.Forms.KeyEventArgs("ぬ") 'set the character in to the keydata for the event argument
TextBox_KeyDown(TextBox, e) call the textbox keydown method - key data passed and fires event - no text.
I've tried for all three events, KeyUp,Down and Press, same result.
I have a workaround using the Textbox.Text and SelectionStart, etc., but I'm just looking for a more elegant solution - I would like the user to be able to click on a button for Japanese, but ALSO use the keyboard for TYPING English and not have to worry about where the cursor is, but because of special keys like Backspace, etc. this starts to involve checking a lot of key data unnecessarily...
Any thoughts appreciated...
Carp