DBCS-Enabled KeyPress Event

The KeyPress event can process a double-byte character code as one event. The higher byte of the keyascii argument represents the lead byte of a double-byte character, and the lower byte represents the trail byte.

In the following example, you can pass a KeyPress event to a text box, whether the character you input is single-byte or double-byte.

Sub Text1_KeyPress (KeyAscii As Integer)
   Mychar = Chr(KeyAscii)
   ' Perform an operation using Mychar.
End Sub

For More Information   See "KeyPress Event" in the Language Reference.