Strange bug? SelectAll() Function
I have many textboxes that all share the same Select all function. There is a strange thing happening however. 50% of the time a mouse click will highlight all and stay that way, works perfect. The other 50% of the time, it will select all and then immediately deselect all. Any ideas?
/// <summary> /// Select All Template (mouse) /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SelectAll_Function_GotMouseCapture(object sender, MouseEventArgs e) { TextBox tb = sender as TextBox; tb.Focus(); // Tried with and without the Focus(); tb.SelectAll(); ///This was the second attempt, same issue. TextBox tb = (sender as TextBox); if (tb != null) { tb.SelectAll(); } }
0 comments:
Post a Comment