hi I am trying to use the API sendmessage to goto a line in my textbox but I get this error.
GotoLine(txtCode, 5)
Code:
A call to PInvoke function 'MyBasic!MyBasic.frmmain::SendMessage' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.
Code:
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long,
ByVal wParam As Long, ByVal LParam As Integer) As Long
Private Sub GotoLine(ByVal tb As TextBox, ByVal Line As Integer)
Dim Ret As Integer = SendMessage(tb.Handle, EM_LINEINDEX, Line - 1, 0)
tb.SelectionStart = Ret
End Sub