Hi,
I'm required to have a textbox pre-filled with some text, and want the cursor to default to the beginning of the textbox when it is focused.
private void txtBox_Enter(object sender, EventArgs e)
{
if (this.txtBox.Text == "SOME PREFILL TEXT")
{
this.txtBox.Select(0, 0);
}
}
I'm capturing _Enter as above and it actually does work if I tab into the text box, but if I mouse-click into the text box, the cursor appears wherever the mouse click was performed, indicating that it is handled after the _Enter event, effectively "overwriting" what I did. To combat this, I hooked in the _Click event to call the txtBox_Enter handler as well, but no luck.
Is there any work around for this?
Thanks, -Ben