How can I insert a backspace into a text box, similar to CRLF?
e.g.
txt.text=txt.text & CRLF <---- needing to be a backspace etc...
The reason im asking is that the text box seems to add and CR when i press enter but i want the cursor to go the the very end of the text, which it doesn't
Sub TxtCon_KeyPress (key)
If key=Chr(13) Then
txtcon.Text=txtcon.Text & CRLF & ">"
txtcon.SelectionStart=StrLength(txtcon.Text)-1 <--- this should go back but it doesnt, im not sure why.
txtcon.ScrollToCaret
There's an other soluce but this work:
txt.Text=SubString(txt.Text,0,StrLength(txt.Text)-1)
But there's an other soluce who is better I think...
Edit:
With the hardware Lib you can, KeyPress(8)....
Klaus avait trouvé 99% de la solution mais le caractère était écrit seulement mais sur le clavier le 8 correspond bien au backspace...
(Sorry I need speak french sometime lol)
Try this one: Sub TextBox1_KeyPress (key) If key=Chr(13) Then txtcon.IgnoreKey txtcon.Text=TextBox1.Text&CRLF&">" txtcon.SelectionStart=StrLength(txtcon.Text) txtcon.ScrollToCaret End If End Sub
Hmm neither ways seem to work, the hardware lib doesnt seem to do anything, but i am using the desktop one, the substring seems to blank out a few lines, plus that would be slow to use. Is the text box designed to add a CR?
Try this one:
Sub TextBox1_KeyPress (key)
If key=Chr(13) Then
txtcon.IgnoreKey
txtcon.Text=TextBox1.Text&CRLF&">"
txtcon.SelectionStart=StrLength(txtcon.Text)
txtcon.ScrollToCaret
End If
End Sub
Hmm neither ways seem to work, the hardware lib doesnt seem to do anything, but i am using the desktop one, the substring seems to blank out a few lines, plus that would be slow to use. Is the text box designed to add a CR?
Yes the Hardware_Desktop lib is hum not really for Desktop cause nothing work lol... Example: MouseClick, KeyDown, KeyPress, KeyUp...
I'll do an other really Lib for Desktop...