November 24th, 2003, 10:21 AM
Changing the cursor location in a text ?
I have a ComboBox, I have a KeyUp events on it. soo it's add the letter then it do something and come back to it. but when it's comeback from the function it was called, the cursor goes to the end. That's problematic
you want to enter montreal
you will press the letters
m -> m
o - > om
n -> nom
t -> tnom
do you understand my problem ! that's why I need to find a way to change the cursor place soo when it's comeback, the cursor will be at the end of the text and not in front !
any body got any idea ?
November 24th, 2003, 10:45 AM
from your example the text is coming back to the front and not the end, unless you read text right to left
I just tested it, (vb.net? or you doing C#?) I put a keyup event and it typed correctly, or do you want it to go back to remove everything in the box each time?
November 24th, 2003, 11:10 AM
I am in vb
soo you said it's going in the back. Yet that's what it's suppose to do. but in my case it's look like it's not doing it.
Private Sub CboCritere_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles cboCritere.KeyUp
'Go the end of the combobox
may be cause cboCritere is being passed by REF, and then when the function is returned, it's have losed his cursor place . Soo I would need to find a way to get the cursor in the back. I don't want to remove anything from what's there.
btw : thank you for your help.
November 24th, 2003, 11:16 AM
Alright I found the answer for this one. Damn me, I forgot that the property SelectionStart existed lol.
soo it was an easy job !
cboCritere.SelectionStart = cboCritere.Text.Length
damn myself lol
November 24th, 2003, 11:21 AM
it's always nice to fine the problems