private void textBox1_MouseClick(object sender, MouseEventArgs e)
{
textBox1.SelectAll();
}
This works but I have 6 textBoxes. Is there any easier way instead of adding event listen开发者_开发技巧ers for each and every textbox? Or a shorthand or something?
Thanks.
Add the same event handler to each and have ((TextBox)sender).SelectAll()
to ensure the one that is clicked on is highlighted.
If you're looking for something more generic create a derived class of TextBox containing the same.
精彩评论