C# & .Net 2.0 question (WinForms)
I have set of items in ComboBox and non of them selected. I would like to show a string on combo \"Pl
Credit must be given to IronRazerz in a response to TextBox watermark (CueBanner) which goes away when user types in single line TextBox (not for RichTextBox).
You will need to declare the following in your class:
private const int CB_SETCUEBANNER = 0x1703;
[System.Runtime.InteropServices.DllImport("user32.dll", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
private static extern int SendMessage(IntPtr hWnd, int msg, int wParam, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)]string lParam);
Then you can use it with something like:
SendMessage(this.comboBox1.Handle, CB_SETCUEBANNER, 0, "Please select an item...");
This is assuming the Combo Box's DropDownStyle is set to DropDownList, as is the original poster's question.
This should result in something like the following: