KeyPress Event

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to read the text property of a textbox from within the KeyPress event.
The text property does not show the last character entered. That character
can be found using e.KeyChar parameter value, but if the user moves the caret
to another position other that the end of the text, that character would not
be in the last position of the text.

Is there a way to know which position of text contains the character
entered?
 
* "=?Utf-8?B?Q2hhcmxpZQ==?= said:
I want to read the text property of a textbox from within the KeyPress event.
The text property does not show the last character entered. That character
can be found using e.KeyChar parameter value, but if the user moves the caret
to another position other that the end of the text, that character would not
be in the last position of the text.

Is there a way to know which position of text contains the character
entered?

Take a look at the textbox's 'SelectionStart' and 'SelectionLength'
properties.
 

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

Back
Top