Reverse string in VB.NET

In VB.NET  you can reverse a string using the StrReverse function. But this source code demonstrates to you how you can reverse string using for loop. 

Here is the source code:

Dim input As String
Dim result As String = “”
Dim len As Integer
Dim a, b As Integer
input = TextBox1.Text
len = input.Length
a = len – 1
For b = 0 To a
result = result & input.Chars(a)
a = a – 1
Next
TextBox2.Text = result

Video demostration:

Download source code:

download source code

🔥443 Views

Anu

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.