Here is another simple program that I wrote using Visual Basic NET to ask the user to give a string and then our program will check and determine if the given string is a Palindrome or Not a Palindrome. The code is very simple and easy to understand. I hope you will learn from this one. Thank you.
My mobile number here in the Philippines is 09173084360.
Sample Program Output
Program Listing
Public Class Form1
Public Function StrPalindrome(ByVal sSource As String) As String
Dim s1 As String
Dim s2 As String
s1 = TextBox1.Text
s2 = StrReverse(s1)
If (s1 = s2) Then
MessageBox.Show("The give word " & UCase(TextBox1.Text) & " is a Palindrome.")
Else
MessageBox.Show("The give word " & UCase(TextBox1.Text) & " is Not a Palindrome.")
End If
End Function
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
End
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim str_word As String
str_word = StrPalindrome(TextBox1.Text)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
TextBox1.Text = ""
TextBox1.Focus()
End Sub
End Class