Sunday, March 5, 2017

Palindrome Checker in Visual Basic 6

Here is another simple program that I wrote using Visual Basic 6 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 email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.






Sample Program Output


Program Listing

Private Sub Command1_Click()
Dim str_word As String

str_word = StrPalindrome(Form1.Text1.Text)
End Sub

Private Sub Command2_Click()
End
End Sub

Private Sub Form_Load()
Form1.Show
End Sub
Public Function StrPalindrome(ByVal sSource As String) As String
    Dim l As Long, strRev As String
    Dim ab() As Byte
    ab = StrConv(sSource, vbFromUnicode)
    For l = UBound(ab) To 0 Step -1
        strRev = strRev & Chr$(ab(l))
    Next l
    If strRev = sSource Then
        MsgBox "The give word " & UCase(Text1.Text) & " is a Palindrome."
    Else
         MsgBox "The give word " & UCase(Text1.Text) & " is Not a Palindrome."
    End If
End Function



No comments:

Post a Comment