Answer the question
In order to leave comments, you need to log in
How to track character positions in a TextBox?
Hi all.
I created 2 textboxes, and I need to make sure that the last time a character is entered in the first textbox, its position in the second textbox is displayed. To solve this problem, I need to understand how to track the position of a character, and I already know how to make an input.
Please explain to a newbie how to do position tracking.
Answer the question
In order to leave comments, you need to log in
protected void TextBox1_TextChanged(object sender, EventArgs e)
{
if (!String.IsNullOrEmpty(textBox1.Text))
textBox2.Text = textBox1.Text.IndexOf(textBox1.Text.Last()).ToString();
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question