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

The following code is used to reverse a word or a sentence:

Public Class Form1
    Dim textToReverse As String
    Dim Letters() As Char
  
    Private Sub Button1_Click(ByVal sender As System.Object, _
     ByVal e As System.EventArgs) Handles Button1.Click
        textToReverse = TextBox1.Text
        Letters = textToReverse.ToCharArray()
        Array.Reverse(Letters)
        Dim ReversedText As New String(Letters, 0, Letters.Length)
        TextBox2.Text = ReversedText
    End Sub
End Class

Result:
Reverse a string in visual basic .net


Share This

Subscribe

More Tutorials

Popular

Home | About | Contact | Privacy Policy

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