To display an Unicode character, you can use following statement
ChrW(n)
where n
is the number representing de Unicode character.
Convert.ToChar(n)
- type directly character in editor using
Alt + N
key combination
- paste/copy Unicode character directly in editor
Char.ConvertFromUtf32(n)
- XML String using
&#x....;
syntax
Example to assign ♥ character :
s = ChrW(&H2665)
s = Convert.ToChar(&H2665)
s = "♥" 'in typing Alt+2665
s = "♥" 'using paste/copy of ♥ from another location
s = Char.ConvertFromUtf32(&H2665)
s = <text>I ♥ you</text>
BUT when Unicode Character is greater than 0xFFFF (C syntax is more readable ), only method 4, 5 and 6 are working !
ChrW()
function indicates an error at build
Convert.ToChar()
function crashes at runtime
- Alt+N is refused because it accepts only 4 digits
Example
lblCharacter.Text = "This solution works "
Debug.Print (Char.ConvertFromUtf32(&H1F600))
s = <text>diable: 😈</text>
PS: smiley pasted (0x1F600) directly in Visual Studio code editor or Notepad++ have lost background color ! Explanation: the smiley pasted in this answer is filled by orange color but in Visual Studio editor or Notepad++, this color has disappeared !
To use String literals in Visual Studio Editor, you must use method 3 or 4 !
In Form (Design mode)

In Properties (see Text property)
