.Net Programming

Check for Palindrome in VB.Net

A String can be checked for palindrome using the String Reverse function in VB.Net.

Related : Checking the Palindrome in C,C++.

Language : VB.Net

Palindrome
[sourcecode language='vb']
Public Class Palindrome

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim str As String
str = StrReverse(TextBox1.Text)
If str.Equals(TextBox1.Text) Then
MsgBox(“This is a Palindrome”)
Else
MsgBox(“Not a Palindrome!”)
End If
End Sub
End Class

[/sourcecode]



Leave a Comment

Notify me of followup comments via e-mail. You can also subscribe without commenting.


WordPress - Vaibhav Kanwal