Quantcast
Channel: .NET Framework Class Libraries forum
Viewing all articles
Browse latest Browse all 8156

write in current position

$
0
0

Hi,

I am developing a virtual keyboard form with all keys on it and a TextBox to write the result

I am using text_position to store the current position in order to write on it

for example if the user wrote Jon and he wanted to add h so he will click after o then click the button O

here is the code:

private void txtKeyboard_Leave(object sender, EventArgs e)
{
    text_position = txtKeyboard.SelectionStart;
}

private void btnKeyH_Click(object sender, EventArgs e)
{
    txtKeyboard.Text = txtKeyboard.Text.Insert(text_position, ((DevExpress.XtraEditors.SimpleButton)sender).Text);
}

now the problem... I can write to the same position with out issue but after clicking btnKeyH  the cursor will remain in the same position although it should move after the newly written h letter.

How can I solve this?


Viewing all articles
Browse latest Browse all 8156

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>