I’m entering data in a datagridview.
Say I’ve entered 678.56 in a cell. Now if I again press digit 6 after 678,
I want to know the last pressed key’s position in the string. Text.IndexOf(e.KeyChar) is giving me position 0 (as there is also a 6).
But I need to know the currently pressed key’s position. I’m using KeyPress event.
Edit: I’m using string value taken from a cell of datagridview. It’s not a textbox. I’m creating a eventhandler as KeyPress.
Look at the character before TextBox.SelectionStart.