CChar Function in VB.NET
How to convert a string to char data type in VB.Net?
Explanation
CChar Function - Convert String to Char
CChar Function in Visual Basic.net 2008 is used to convert String expression to Character datatype.
Syntax:
CChar(expression)
Example:
Module Module1
Sub Main()
Dim Str As String = "aaaa"
Console.WriteLine("String converted to Bytes Datatype is::"
& CChar(Str))
Console.ReadLine()
End Sub
End Module
Result:
String converted to Bytes Datatype is::a
In the above example, CChar() is used to convert the first character of the string to character
datatype.