e.KeyCode is already a number. Implicitly converting it to a String in order to parse it in order to convert it to a String is a bit roundabout, not to mention that it won't compile with Option Strict On.
vb.net Code:
Private Sub Form1_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyUp
That still won't compile with Option Strict On, which everyone should have all the time unless they specifically need it Off. That's why I used this:
vb.net Code:
txtDecimal.Text = CStr(e.KeyCode)
instead of this:
vb.net Code:
txtDecimal.Text = e.KeyCode
Also, if you call the ToString with no parameters will return a string containing the enumerated value's label. If you do specify a parameter then it will not. When you call the ToString method of an integer value, which enums are, and specify "X" as the format string you'll get a hexadecimal string in upper case. That would be preferable to using the Hex Runtime function for many people, although ToString does pad to a 32-bit number with zeroes.