by Tomas Tupy (6 Submissions)
Category: String Manipulation
Compatability: Visual Basic 5.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating:
(5 Votes)

With this extremely easy code, you can erase a character at the end of a string or in a textbox with a click of a button. Very easy code and every line is commented. DON'T forget to vote.
API DeclarationsDim backlength As Integer
Dim backString As String
Dim backlength As Integer
'declare the variable in which the length will be stored
Dim backString As String
'declare the string in which Text1 wil be stored
Private Sub Command1_Click()
backlength = Len(Text1.Text)
'find the length of the text in the textbox
backString = Mid(Text1.Text, 1, (backlength - 1))
'save that text without the last character into the string
Text1.Text = backString
'display the string in the text box
End Sub
'You can replace Text1.Text with a string name