Hi all,
I am trying to select all text in a textbox when it gains focus, either by keyboard or mouse - as is common in UI's. I have tried using the GotFocus and Enter events but neither of them worked when clicking in the textbox. Seems they fire too early and the selection is overriden by the mouse click.
Here is the code I used
As I said above it works with keyboard but not with mouse. So can anyone advise me of a decent method to achieve this effect both ways?Code:void textbox_Enter(object sender, EventArgs e) { ((TextBox)sender).SelectAll(); }
Thanks
- P




Reply With Quote