How do I fill an empty textbox with default text?

后端 未结 6 1729
独厮守ぢ
独厮守ぢ 2020-12-01 08:55

How do I fill a textbox with text if it is empty? I am using VB.NET.

6条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-01 09:25

    I would create a class that inherits TextBox and do two things with it:

    • Add DefaultText string property
    • Override the Text setter to always set this DefaultText if the new Text value is String.Empty

提交回复
热议问题