Highlight text in textbox2,selected word in textbox1

Mar 24 2015 4:21 AM
I wants to highlight text in textbox2,selected word in textbox1
 
 like this picture :  http://i.stack.imgur.com/3juO5.jpg
 
[CODE]
  private void textBox1_TextChanged(object sender, EventArgs e)
{
String A = textBox1.Text.Trim();
textBox2.Text = (A);

}

private void textBox1_MouseUp(object sender, MouseEventArgs e)
{
if (textBox1.SelectionLength > 1)
{
textBox2.Select(Strings.InStr(textBox2.Text, textBox1.SelectedText, CompareMethod.Text) - 1, textBox1.SelectionLength);
textBox2.Focus();
}
}
[/CODE]
 
Tried this code,but it's not working,plz help me
 

Answers (1)