I want to cut out part of a text in a TextField. I’d like the cursor to stay where I cut out some text, but somehow it jumps to the end of the text.
How do I accomplish that to put the cursor at the SelStart position?
cb.Text = mid(FieldName.text,FieldName.SelStart,FieldName.SelLength+1)
FieldName.Text = left(FieldName.Text,FieldName.SelStart)+mid(FieldName.Text,FieldName.SelStart+FieldName.SelLength+1)
You need to re-place it at the correct SelStart after you reset the .Text
value.
Forum code disclaimer.
dim iSelStart as Integer = txtDescriptiveControlName.SelStart
dim sTxtValue as String = txtDescriptiveControlName.Text
// Manipulate your sTxtValue
txtDescriptiveControlName.Text = sTxtValue
txtDescriptiveControlName.SelStart = iSelStart
That’s it!
I assumed that selstart had to do with a (partly) select text, and since it was cut out, there was no selstart anymore.
Thanks.