Need help with KeyDown

G

Guest

Hi,

I have a textBox, i want to add after each Keydown Event the char *,
i did textbox1=textbox1.Text + "*";
but i can i send the coruser to the end of the line so the next letter will
be placed after the * so for example if the user pressed a and then b, i will
get a*b*.

i need to do it with KeyDown event or KeyPress...

Thanks,
Gidi
 
K

Kevin Spencer

Set the SelectionStart property of the TextBox to the length of the content,
and the SelectionLength to 0.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Hard work is a medication for which
there is no placebo.
 
G

Guest

Hi Kevin,

THANK YOU VERY VERY MUCH.

I looked for this solution for so long...

actually i tried to do this with KeyUp, but for some reason, My KeyUp Event
is not being called. now you helped me to do what i wanted with keyup....

Thanks a lot.
Gidi.
 

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