How to give an initial value to textBox?

前端 未结 4 1468
谎友^
谎友^ 2021-01-14 17:03

I want my C# program to have initial values for its textboxes. For example, in one of the textboxes, it should say \"Please enter your name\"

4条回答
  •  借酒劲吻你
    2021-01-14 17:33

    All you need to do is set the Textbox's .Text property and use GotFocus event to clear the box when the person clicks (or tabs) into it to start typing.

    Always remember that there are more ways than the mouse to navigate a form, so use the GotFocus event to determine when the user enters a control, and use the Validated event to determine when they've changed data and exited the control.

提交回复
热议问题