VB.NET Tutorial





Español Français 中文 Deutsch Portuguese Japanese nederlands
   
 
Visual Basic Tutorial
Introduction
Installation
Creating Project
Saving a Project
Compile, Run a Project
Open an Existing Project
VB IDE
Forms
VB Datatypes
Constants
Variables
User Defined Datatypes
VB Control Structure
VB Loops
Operators
VB Controls
Dialog Controls
Console Programming
VB Objects,Classes
VB Arrays
Math Functions
String Functions
Type Conversion Functions
Date Time Functions
Databases in VB.net
Enumeration
File Handling
Debugging
Debugging Tools
Exception Handling
Samples
Feedback
 

CChar Function in VB.NET

Tutorials Vbnet

Topic

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.







Other Links

web hosting