|
-
Mar 12th, 2000, 07:48 AM
#1
Thread Starter
Addicted Member
I've see code posted before that reverses either a string or a file. Does anyone have this code on hand? Thanks in advance.
Cbomb
Techie 
-
Mar 12th, 2000, 07:59 AM
#2
Frenzied Member
Try this...
The easiest way to reverse a string that I know of...
Create a project and place a command button and a text box on the form.
Paste the following code into the form's code window, run the project, type some text into the text box, and then click the command button.
Code:
Option Explicit
Private Function ReverseString(sStringIn As String) As String
Dim nCounter As Integer
For nCounter = 1 To Len(sStringIn)
ReverseString = Mid$(sStringIn, nCounter, 1) & ReverseString
Next nCounter
End Function
Private Sub Command1_Click()
Text1 = ReverseString(Text1)
End Sub
Unless you are using VB6.0, of course, which has a string reverse function built in, called StrReverse. This is implemented in the same manner:
Code:
Text1 = StrReverse(Text1)
Edited by seaweed on 03-12-2000 at 08:40 PM
-
Mar 12th, 2000, 08:56 AM
#3
Of interest if you are using vb5, but the following code into a Textbox change event.
Private Text.Change()
Text = ucase(Text)
Reverses the text string, strange but true.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|