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:

See Also

Concepts

Converting Strings to .NET Framework Data Types

Creating New Strings

Strings Sample

Other Resources

Strings in Visual Basic

Parsing Strings

Manipulating Strings

Building Strings in Visual Basic