VB.Net program to demonstrate the Concat() method of String class

Here, we are going to demonstrate the Concat() method of String class in VB.Net.
Submitted by Nidhi, on January 20, 2021

The Concat() method is used to concatenate two strings and return the concatenated string to the calling function.


Function Concat (ByVal str1 as String, ByVal str2 as String) as String


  • Str1: String to be concatenated.
  • Str2: String to be concatenated.

Return Value: It returns the concatenated string based on specified strings.

Program/Source Code:

The source code to demonstrate the Concat() method of the String class is given below. The given program is compiled and executed successfully.

'VB.NET program to demonstrate the Concat() 
'method of String class.

Imports System

Module Module1
    Sub Main()
        Dim str1 As String = "Hello "
        Dim str2 As String = "World "
        Dim str3 As String

        str3 = String.Concat(str1, str2)

        Console.WriteLine("Str1: {0}", str1)
        Console.WriteLine("Str2: {0}", str2)
        Console.WriteLine("Str3: {0}", str3)
    End Sub
End Module


Str1: Hello
Str2: World
Str3: Hello World
Press any key to continue . . .


In the above program, we created a module Module1 that contains the Main() function. The Main() function is the entry point for the program.

In the Main() function, we created three strings str1, str2, and str3. Here, we concatenated two strings str1 and str2 and assigned the concatenated string into str3. After that, we printed all strings on the console screen.

VB.Net String Programs »


Comments and Discussions!

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.