Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hello,
I want to ask how one can programatically make a text appear in a textbox like "Type user name here" and make that instructional text clear as the user actually enters something into that textbox.
I want to do this in a C# Windows Forms application.

Thanks!
Posted
Updated 3-Aug-18 7:59am
v2
Comments
Sergey Alexandrovich Kryukov 8-Jul-13 21:12pm    
"Clear away" is not clear.
—SA
[no name] 8-Jul-13 21:12pm    
That makes no sense at all.... but if that is really what you want to do, try yourTextbox.Text = string.Empty
MuhammadUSman1 8-Jul-13 21:27pm    
Couldn't understand your Question?
suleman115 8-Jul-13 22:24pm    
actualy i have a log in form and i want to write user name in the textbox where user should give his user name...and i want this 'user name' text to be like google is written in Google's search box...clear now?..how to do it?
[no name] 8-Jul-13 22:31pm    
Then the thing you need to search for is "watermark".

I hope this is what you need:

[TextBoxWatermark Demonstration]

That should help you!
 
Share this answer
 
v2
 
Share this answer
 
Comments
suleman115 13-Jul-13 2:17am    
thank you for the solution, I tried it first and it worked..Thanks:)
There is an article here on CP that does this: Custom TextBox with Watermark[^].

Regards,
— Manfred
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900