0

In VB6 I could say

Dim s as string
s = ChrW(937)

But I did not find a function in .NET without using the Microsoft.VisualBasic runtime to do that.

Can somebody tell me how this can be done?

Is the following code correct?

Public Function ChrW(ByVal uKeyCode As Integer) As String

    Dim nChar As Char = Char.ConvertFromUtf32(uKeyCode)
    Return New String(nChar, 1)

End Function

Thank you!

zbynour
  • 19,747
  • 3
  • 30
  • 44
tmighty
  • 10,734
  • 21
  • 104
  • 218
  • possible duplicate of [What is the C# equivalent of ChrW(e.KeyCode)?](http://stackoverflow.com/questions/6060576/what-is-the-c-sharp-equivalent-of-chrwe-keycode) – LosManos Mar 21 '14 at 22:26

1 Answers1

1

Try

var myKeyChr = char.ConvertFromUtf32((int) e.KeyCode)

as already mentioned in SO.

Community
  • 1
  • 1
LosManos
  • 7,195
  • 6
  • 56
  • 107