I found the code in Watermark TextBox in WinForms but it is C# version, so I use http://converter.telerik.com/ to convert the code to VB version, but I still get error......
Error happen on this line:-
SendMessage(Me.Handle, &H1501, DirectCast(1, IntPtr), mCue)
How can I fix it?
ERROR MESSAGE: BC30311 Value of type 'Integer' cannot be converted to 'IntPtr'.
Imports System.ComponentModel
Imports System.Windows.Forms
Imports System.Runtime.InteropServices
Class CueTextBox
Inherits TextBox
<Localizable(True)> _
Public Property Cue() As String
Get
Return mCue
End Get
Set
mCue = value
updateCue()
End Set
End Property
Private Sub updateCue()
If Me.IsHandleCreated AndAlso mCue IsNot Nothing Then
SendMessage(Me.Handle, &H1501, DirectCast(1, IntPtr), mCue) 'this line get the error msg
End If
End Sub
Protected Overrides Sub OnHandleCreated(e As EventArgs)
MyBase.OnHandleCreated(e)
updateCue()
End Sub
Private mCue As String
' PInvoke
<DllImport("user32.dll", CharSet := CharSet.Unicode)> _
Private Shared Function SendMessage(hWnd As IntPtr, msg As Integer, wp As IntPtr, lp As String) As IntPtr
End Function
End Class