| | |
vb6 palindrome
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Feb 2008
Posts: 5
Reputation:
Solved Threads: 0
hey
I am trying to make a program on visual basic 6 to determine weather a
word or phrase is a palindrome or not. I need my program to be able to
tell if the word or phrase is a palindrome and it not being case
sensitive. The code below words to a certin point then brings up an
error but i have no clue why it wont work any help will be appreciated.
Thanks
I know some things that need to be inculued : arrays and fixed loops and it also needs to take out white spaces.
I am trying to make a program on visual basic 6 to determine weather a
word or phrase is a palindrome or not. I need my program to be able to
tell if the word or phrase is a palindrome and it not being case
sensitive. The code below words to a certin point then brings up an
error but i have no clue why it wont work any help will be appreciated.
Thanks
I know some things that need to be inculued : arrays and fixed loops and it also needs to take out white spaces.
Never tried = Never Know
So, Please do something before post your thread.
* PM Asking will be ignored *
So, Please do something before post your thread.
* PM Asking will be ignored *
•
•
Join Date: Sep 2008
Posts: 34
Reputation:
Solved Threads: 2
Dim le
Dim mide
Dim i
Private Sub Command1_Click()
i = 0
Dim yes As Boolean
le = Len(Text1.Text) + 1
Do While i < Len(Text1.Text) - 1
i = i + 1
mide = mid(Text1.Text, i, 1) 'take the next 1 letter in text1.text from position i
If Not mide = mid(Text1.Text, le - i, 1) Then 'if its not the same as the leter i positon from the back then
yes = True
End If
Loop
If yes = False Then
MsgBox "Pal"
Else
MsgBox "Not"
End If
End Sub
Dim mide
Dim i
Private Sub Command1_Click()
i = 0
Dim yes As Boolean
le = Len(Text1.Text) + 1
Do While i < Len(Text1.Text) - 1
i = i + 1
mide = mid(Text1.Text, i, 1) 'take the next 1 letter in text1.text from position i
If Not mide = mid(Text1.Text, le - i, 1) Then 'if its not the same as the leter i positon from the back then
yes = True
End If
Loop
If yes = False Then
MsgBox "Pal"
Else
MsgBox "Not"
End If
End Sub
•
•
Join Date: Nov 2007
Posts: 140
Reputation:
Solved Threads: 15
Or... use the strReverse command
You could change that to a function and return a boolean value instead of message boxes if you preferred.
Note: Just read the OP again and saw he needs it to use arrays and fixed loops which my example doesn't use. Oh well, I'll post it anyway for reference
Edit: sucked into an old thread again... fail
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Private Sub PalindromeTest(ByVal sWord As String) Dim sReversedWord As String sReversedWord = StrReverse(sWord) If StrComp(sWord, sReversedWord, vbTextCompare) = 0 Then MsgBox "Palindrome!" Else MsgBox "Not a Palindrome!" End If End Sub
You could change that to a function and return a boolean value instead of message boxes if you preferred.
Note: Just read the OP again and saw he needs it to use arrays and fixed loops which my example doesn't use. Oh well, I'll post it anyway for reference

Edit: sucked into an old thread again... fail
Last edited by jonifen; Apr 6th, 2009 at 5:15 pm. Reason: Sucked in again :/
![]() |
Similar Threads
- Palindromes on visual basic 5.0 (Visual Basic 4 / 5 / 6)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: Windows email and vb6
- Next Thread: Help with Shell or any other simmilar function
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age append application basic beginner birth bmp calculator cd cells.find click client code college column component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report retrieve save search sendbyte sites sort sql sql2008 sqlserver subroutine table tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows






