Home > Blockchain >  how to show in a text field the default or an example of what the user should input vb.net
how to show in a text field the default or an example of what the user should input vb.net

Time:09-11

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.

CodePudding user response:

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

  • Related