Showing a hint for a C# winforms edit control

Question :

Showing a hint for a C# winforms edit control,

Answer :

I’m working on a C# winforms application (VS.NET 2008, .NET 3.5 sp 1). I have a search field on a form, and rather than have a label next to the search field I’d like to show some grey text in the background of the search field itself (‘Search terms’, for example). When the user starts entering text in the search field the text should disappear. How can I achieve this?

,

You will need to use some P/Inovke interop code to do this. Look for the Win32 API SendMessage function and the EM_SETCUEBANNER message.

Read More  What is the difference between procedural programming and functional programming?

That’s the answer Showing a hint for a C# winforms edit control, Hope this helps those looking for an answer. Then we suggest to do a search for the next question and find the answer only on our site.

Disclaimer :

The answers provided above are only to be used to guide the learning process. The questions above are open-ended questions, meaning that many answers are not fixed as above. I hope this article can be useful, Thank you