PDA

Click to See Complete Forum and Search --> : Reversing text in a text box????????


biosupgrade
Dec 3rd, 1999, 08:20 PM
Hi,

I am writing a program so when you write text in a text box it displays the same text in a label but backwards eg.
text box = Jason
label = nosaJ
Can someone please help me???
Thanks in advance.

Steve Stunning
Dec 3rd, 1999, 08:35 PM
Thry this, it works.. :)

Word = Text1.Text
L = Len(Word)
Temp = String$(L, 32)

For x = 1 To L
a = Mid$(Word, x, 1)
Mid$(Temp, (L - x) + 1, 1) = a
Next x

Label1.Caption = Temp

Compwiz
Dec 3rd, 1999, 08:54 PM
If you have VB6, then you can use the StrReverse function like this:


Private Sub Command1_Click()
Text1.Text = StrReverse(Text1.Text)
End Sub


Remember, that only works with VB6.

------------------
Tom Young, 14 Year Old
tyoung@stny.rr.com
ICQ: 15743470 (http://wwp.icq.com/15743470) Add Me (http://wwp.icq.com/scripts/search.dll?to=15743470) ICQ Me (http://wwp.icq.com/scripts/contact.dll?msgto=15743470)
AIM: TomY10 (http://www.aol.com/aim/aim30.html)
PERL, JavaScript and VB Programmer

Steve Stunning
Dec 4th, 1999, 05:33 AM
I did not know that... :) Learn somthing new here every day!!!

Ruchi
Dec 5th, 1999, 11:52 AM
If you don't have VB6, add two labels on your form


Private Sub Form_Load()
Dim sstring As String
Dim iposition As Integer

Label1.Caption = "VB PROGRAMMER"

sstring = Label1.Caption

For iposition = Len(sstring) To 1 Step -1
Label2.Caption = Label2.Caption & Mid$(sstring, iposition, 1)
Next
End Sub



Hope this works for you

Ruchi

jritchie
Dec 6th, 1999, 12:03 PM
Just try formatting your string on the text click event, (in vb5) automatically reverses it.

txtEntry.Click()
txtEntry = UCASE(txtEntry)

Just add whatever code you want to use for this weird happening, e.g label = UCASE(txtEntry)