Search code examples
c#vb.netcharkeycodevb.net-to-c#

What is the C# equivalent of ChrW(e.KeyCode)?


In VB.NET 2008, I used the following statement:

MyKeyChr = ChrW(e.KeyCode)

Now I want to convert the above statement into C#.

Any Ideas?


Solution

  • Looks like the C# equivalent would be

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

    However, e.KeyCode does not contain a Unicode codepoint, so this conversion is meaningless.