: : Hi,
: : lets say i have the following word: Hello
: : SO when i press a button i want to remove the "o" and if i press it
: : again to remove the "l" ctr..
: :
: : i think i must use a function...but i dont know which and how.
: :
: : thanks.
:
: Use Left$, Mid$ and Right$ to take portions of the string.
: Basically, removing a character at position n (where position 1 is
: the first character) means: Left$(s, n - 1) & Mid$(s, n + 1). This
: is taking the part before the character-to-be-removed, and the part
: after and pasting them back together.
:
: Best Regards,
: Richard
:
: The way I see it... Well, it's all pretty blurry
:
IMHO it will be better idea to use Replace() and InStr() functions.
Replace(
Expession as String,Find as String,Replace as String,[Start as Long = 1],[Count as Long = 1]) As String
InStr([
Start],[
String1],[
String2]) As Long
Something like that
Dim strSelText As String
If InStr(Text1, "o") > 0 Then
strSelText = "o"
Text1 = Replace(Text1.Text, strSelText, "", 1)
Else
If InStr(Text1, "e") > 0 Then
strSelText = "e"
Text1 = Replace(Text1.Text, strSelText, "", 1)
End If
End If
Or this code
Private Sub Command1_Click()
Dim strSelText As String
strSelText = Right(Text1, 1) 'select last letter
Text1 = Replace(Text1.Text, strSelText, "", 1, 1)
End Sub
Of course it's just an idea and you have to modify it according to your needs