Powered by Blogger.

Concatenate 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.




1
2
3
4
5
' 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)