Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Characters in Text Box....

Status
Not open for further replies.

dodgyone

Technical User
Jan 26, 2001
431
GB
How would I edit the contents of a text box when...

*If there are 3 characters in the text box then delete the *last character.

*If the last character in the text box is \ then delete *that character.

Or is there any othe way which is easier?

Cheers...
 
If the text box is called text1 you can use the following:
If Text1.Text <> &quot;&quot; Then
If Len(Text1.Text) > 3 Then
Text1.Text = Mid(Text1.Text, 1, 3)
End If
If Mid(Text1.Text, (Len(Text1.Text)), 1) = &quot;\&quot; Then
Text1.Text = Mid(Text1.Text, 1, (Len(Text1.Text) - 1))
End If
End If

If you try to fill out \\\\ you wil get an error.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top