How about assigning a ToolTip to a TextBox and putting all the "talk what textbox" in it?
Just drag the ToolTip inside the form. And then in each TextBox property you should have an additional entry in the Misc ToolTip on toolTip1 (or whatever that name would be if you renamed it).
Then, when the user hovers over the TextBox (Read-Only / Disabled TextBox , the tooltip doesn't seem to be displayed) and stops there for 1 second, the ToolTip should show with the corresponding information.
You may, in the end or even better, have a Label next to the TextBox saying that it is, but having ToolTip also a good idea to explain additional information to the user.
To work with WaterMark you do not need to go a long way, setting events, taking care of SelectAll, etc., you can do it like this. Create a new watermark.cs file and replace it with this code. Make sure you change the namespace to match the program namespace.
#region using System; using System.Runtime.InteropServices; using System.Windows.Forms; #endregion namespace Watermark { public static class TextBoxWatermarkExtensionMethod { private const uint ECM_FIRST = 0x1500; private const uint EM_SETCUEBANNER = ECM_FIRST + 1; [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = false)] private static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, uint wParam, [MarshalAs(UnmanagedType.LPWStr)] string lParam); public static void SetWatermark(this TextBox textBox, string watermarkText) { SendMessage(textBox.Handle, EM_SETCUEBANNER, 0, watermarkText); } } } internal class WatermarkTextBox : TextBox { private const uint ECM_FIRST = 0x1500; private const uint EM_SETCUEBANNER = ECM_FIRST + 1; private string watermarkText; public string WatermarkText { get { return watermarkText; } set { watermarkText = value; SetWatermark(watermarkText); } } [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = false)] private static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, uint wParam, [MarshalAs(UnmanagedType.LPWStr)] string lParam); private void SetWatermark(string watermarkText) { SendMessage(Handle, EM_SETCUEBANNER, 0, watermarkText); } }
In your form, you activate it as follows:
textBoxYourWhatever.SetWatermark("Text that should display");
It stays there while the TextBox empty. When users get into the TextBox , the text disappears. It appears again when the TextBox is cleared (by the user or automatically). No special events needed, etc.
EDIT:
I also added an inner WaterMarkTextBox class that gives you the ability to simply use the new WaterMarkTexBox, which is made available in Designer. Then drag it to your designer and use it. It behaves like a regular text block, just giving you the optional WaterMarkText field.
I still prefer the first method. Doesn't make you rebuild your gui again.