dear sir,
I'm trying to set watermark when textbox multiline with vb.net but no success
please guide me
Imports System.Runtime.InteropServices
Imports System.Runtime.CompilerServices
Public Module TextBoxExtensions
Private Const ECM_FIRST As UInteger = &H1500
Private Const EM_SETCUEBANNER As UInteger = ECM_FIRST + 1 '(TextBox)
Private Const CB_SETCUEBANNER As Integer = &H1703 '(ComboBox)
<DllImport("user32.dll", EntryPoint:="SendMessageW")>
Private Function SendMessageW(hWnd As IntPtr, Msg As UInt32, wParam As IntPtr, <MarshalAs(UnmanagedType.LPWStr)> lParam As String) As IntPtr
End Function
<Extension()>
Public Sub SetWaterMark(tb As TextBox, watermark As String)
Dim x As IntPtr
x = CType(0, IntPtr)
SendMessageW(tb.Handle, EM_SETCUEBANNER, x, watermark)
End Sub
<Extension()>
Public Sub SetWaterMark(tb As AmmaSDK.AmmaMaterialTextbox, watermark As String)
Dim x As IntPtr
x = CType(0, IntPtr)
SendMessageW(tb.Handle, EM_SETCUEBANNER, x, watermark)
End Sub
<Extension()>
Public Sub SetWaterMark(cb As ComboBox, watermark As String)
Dim x As IntPtr
x = CType(0, IntPtr)
SendMessageW(cb.Handle, CB_SETCUEBANNER, x, watermark)
End Sub
Public Sub New()
' This call is required by the designer.
InitializeComponent()
TextBox1.Text = ""
TextBox1.SetWaterMark("NAMEINV")
End Sub