I'm trying to set a default value in a text input field which gives the user an example of what to enter. This should be in grey color and should disappear as soon as they start typing.
Asked
Active
Viewed 54 times
0
-
1Do you mean _Cue Banner_? If so, https://stackoverflow.com/a/59803179/14171304 – dr.null Sep 09 '22 at 18:02
-
1@dr.null i think it is... Let me try it out. Thank you for pointing to the right direction – Waddah Shamroukh Sep 09 '22 at 18:17
-
1Maybe [WaterMark Textbox](https://www.experts-exchange.com/articles/362/Custom-WaterMark-TextBox-for-Windows-Forms-VB-Net.html)? – dwpessoa Sep 09 '22 at 19:20
1 Answers
1
Add a placeholder attribute in code behind - if your textbox is
<asp:textbox runat="server" ID="mytextbox" />
Then in code behind add
mytextbox.Attributes.Add("placeholder", "example text")
[edit] - sorry, I'm thinking of web forms, not windows forms...
[edit] see here: Placeholder in TextBox in Window Forms using VB.NET

PSU
- 175
- 1
- 9