Dear All,
I am using this code to get the Line Number from a given position in a Richtextbox.
VB Code:
Option Explicit Public Declare Function SendMessage Lib _ "user32" Alias "SendMessageA" _ (ByVal hwnd As Long, _ ByVal wMsg As Long, _ ByVal wParam As Long, _ lParam As Any) As Long Public Const EM_LINEFROMCHAR = &HC9 Public Function TextBoxLineNumberFromCursor(TBox As RichTextBox, pos As Long) As Long TextBoxLineNumberFromCursor = SendMessage(TBox.hwnd, EM_LINEFROMCHAR, pos, 0&) End Function 'and I call this Function as Dim x as long 'rtb is richtextbox x=TextBoxLineNumberFromCursor(rtb,32271) 'and I am getting an oveflow error for this 'I dont know why


Reply With Quote