From MSDN entry for Control.ResetText():
Resets the Text property to its default value.
Stupid question, but I can’t find where I can set this “default value”. When I invoke ResetText() on TextBox all text is simply cleared.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The default value used by
ResetTextin theTextBoxcontrol is not configurable and it happens to be thestring.Emptyso that’s why when you invoke the method the text is cleared.However, since the
ResetTextmethod is virtual you can do the following:Now, you just need to use your
MyTextBoxinstead of theTextBoxcontrol. This is of course complicating things just for the sake of setting theTextproperty, so you are better of by assigning your default text directly to theTextproperty if you have no requirements to support a default value specifically through the use ofResetText.