How do you declare a Char literal in Visual Basic .NET?

Jason Berkan picture Jason Berkan · Jul 30, 2010 · Viewed 40.2k times · Source

With Option Strict On:

Dim theLetterA As Char = "A"

returns an error about converting the string "A" to a Char.

What is the syntax to enter a Char literal?

Answer

Jeff Mercado picture Jeff Mercado · Jul 30, 2010

A character literal is entered using a single character string suffixed with a C.

Dim theLetterA As Char = "A"C