Concatenate Strings in Visual Basic .NET

Tags: VB.NET, VB 2008, VB 2010, VB 2012, VB 2013

This lesson explains concatenating strings in Visual Basic .NET

Visual Basic provides two concatenation operators: + and &. Both join two strings together.

Because the + symbol also represents an arithmetic operator, your code will be easier to read if you use the & symbol also knows as ampersand, for concatenation.

Using & can also make your code faster and lead to fewer problems because it lets Visual Basic know that the operands are strings.

                        ' make a full name concatenate the first and the last name
                        Dim FullName As String = String.Empty
                        FullName = FirstName.Text & " " & LastName.Text
                        ' test the result
                        Console.WriteLine(FullName)
                    

Previous Lesson | Next Lesson


Share This

Home | About | Contact | Privacy Policy

Copyright visual-basic-tutorials.com 2017 - All Rights Reserved.