Control the input cursor?

R

Rader

As the textbox is focused,if I press the keys up/down arrow instead of
other keys like a,b,c......
the input cursor moves left and right.Now its the problem,I want the
cursor stay where it was(stop moving), as I press the up/down key.Can I
do that through recoding the textbox's events in c#?

I appreciate everyone can help me,thanks in advance~
 
M

Michael Nemtsev

Hello Rader,

Add KeyDown handler for your control and use this code

if (e.KeyCode == Keys.Up || e.KeyCode == Keys.Down)
{
e.Handled = true;
}

R> As the textbox is focused,if I press the keys up/down arrow instead
R> of
R> other keys like a,b,c......
R> the input cursor moves left and right.Now its the problem,I want the
R> cursor stay where it was(stop moving), as I press the up/down key.Can
R> I
R> do that through recoding the textbox's events in c#?
R> I appreciate everyone can help me,thanks in advance~


---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top