How to: Generate Multiline String Literals (Visual Basic)
This example constructs a string literal that is three lines long.
Example
Dim MyString As String
MyString = "This is the first line of my string." & VbCrLf & _
"This is the second line of my string." & VbCrLf & _
"This is the third line of my string."
This code example is also available as an IntelliSense code snippet. In the code snippet picker, it is located in Data Types - defined by Visual Basic. For more information, see How to: Insert Snippets Into Your Code (Visual Basic).
Compiling the Code
This example requires:
- An Imports statement specifying the System namespace. For more information, see Imports Statement (.NET Namespace and Type).
See Also
Concepts
Converting Strings to .NET Framework Data Types