I asked a question similar to this a few days ago here. The answer works fine, with the exception of performing the same operation at the start up of the window. This means that I need to have the text in a textBox
highlighted every time the window is opened.
Currently I am setting the focus to the textBox
at startup with no problem in the constructor. With that being said, I am guessing that the correct area to perform this operation is in the constructor. This is what I am trying currently with no luck:
public AddDestination()
{
InitializeComponent();
//Give cursor focus to the textbox
destination_textBox.Focus();
//Highlights text **DOES NOT WORK
destination_textBox.SelectionStart = 0;
destination_textBox.SelectionLength = destination_textBox.Text.Length;
}
How can I make it so that the text inside my textBox
is highlighted whenever the window opens?