Monday, 9 September 2013

Making TextBox Clear when user starts typing

Making TextBox Clear when user starts typing

I have two text boxes in a win forms that the user will be typing
information into. I would like to clear the text box when the user start
typing. I am using the TextChanged event handler, so every time I type it
will erase, which makes me not able to type anything into the text box.
Here is the code I am using:
private void TXTBX_HourlyRatae_TextChanged(object sender, EventArgs e)
{
TXTBX.HourlyRate.Clear();
TXTBX.HoursWorked.Clear();
}
I understand that everytime I type into the text box I will be executing
this event handler, but I don't know how to go about making it execute
only the first time I type into the text box.

No comments:

Post a Comment