Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Visual Basic provides character data types for dealing with printable and displayable characters. While they both deal with Unicode characters, Char holds a single character while String contains an indefinite number of characters.
For a table showing a side-by-side comparison of the Visual Basic data types, see Data Type Summary (Visual Basic).
Char Type
The Char data type is a single two-byte (16-bit) Unicode character. If a variable always stores exactly one character, declare it as Char.
For more information, see Char Data Type (Visual Basic).
String Type
The String data type is a sequence of zero or more two-byte (16-bit) Unicode characters. If a variable can contain an indefinite number of characters, declare it as String.
For more information, see String Data Type (Visual Basic).
See Also
Tasks
Troubleshooting Data Types
How to: Hold Characters in a Variable
Concepts
Composite Data Types
Generic Types in Visual Basic
Typeless Programming in Visual Basic
Type Characters
Other Resources
Elementary Data Types
Data Type Implementation
Type Conversions in Visual Basic