I need to have a watermark on both of my form using this
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);
}
}
I tried to use this to both form but I got an error saying
"Ambiguity between namespace.TextBoxWatermarkExtensionMethod.ECM_FIRST and namespace.TextBoxWatermarkExtensionMethod.ECM_FIRST."
I think this class must not duplicate. But how to call it between the two form.