That you can follow me, it's the best you create a small application containing the following code:
public Form1()
{
InitializeComponent();
textBox1.Text = "Any Text";
textBox1.Click += delegate
{
textBox1.Select(0, 0);
};
}
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
linkLabel1.Focus();
}
The linkLabel1
is only there that you can leave the focus from the textBox1
.
And now, just click on the textBox
.
The Select
Method works and the first position of the Text is selected.
The problem is, first the clicked position is selected. Just for a short time but still pretty annoying.
I already tried this.SuspendLayout()
in the GotFocus
Event (because this gets fired before Click) and this.ResumeLayout()
in the Click Event, but no success.
Do you have any idea?