Click to See Complete Forum and Search --> : How to remove a selected character from the textbox?


AndyK
March 8th, 2000, 04:45 PM
I tried SendKeys "{del}", it works but it deletes something that needs to be remained, is there any other way to remove character?

Programs and requests for them for FREE.
http://falstok.fly.to

SecretHell
March 8th, 2000, 04:56 PM
Maybe this isn't what you mean, but why don't you try something like this :

Private Sub Command1_Click()
Dim txt As String
With Text1
txt = ""
txt = Mid(.Text, 1, .SelStart)
txt = txt & Mid(.Text, .SelStart + .SelLength + 1, Len(.Text) - (.SelStart + .SelLength))
.Text = txt
End With
End Sub

SecretHell
If you ain't makin' waves, you ain't kickin' hard enough

Chris Eastwood
March 8th, 2000, 05:12 PM
If you have a normal textbox (Text1) and a button (Command1) and the text is 'Chris' with the 'i' selected, try :


private Sub Command1_Click()
'
Text1.SelText = ""
'
End Sub





Chris Eastwood

CodeGuru - the website for developers
http://codeguru.developer.com/vb