Find Code:
All Words
Any of the Words
Exact Phrase
Home
:
Code
:
Forums
:
Submit
:
Mailing List
:
About
:
Contact
Code
All
VB.NET
ASP.NET
C#
VB Classic
ASP Classic
Snippets
Popular
Resources
Submit Code
Forums
Articles
Tips
Links
Books
Contest
Link to us
Display the caret's coordinates of a RichTextbox. ...
Author:
Alexander Triantafyllou
E-mail:
Click to e-mail author
Submitted:
4/8/2003
Version:
VB5
Compatibility:
VB5, VB6
Category:
String Manipulation
Views:
12293
Display the caret's coordinates of a RichTextbox.
Declarations:
'IN A MODULE Public Declare Function SendMessage Lib "user32" _ Alias "SendMessageA" _ (ByVal hWnd As Long, _ ByVal wMsg As Long, _ ByVal wParam As Long, _ ByVal lParam As Any) As Long Public Const WM_USER = &H400 Public Const EM_EXLINEFROMCHAR = (WM_USER + 54) Public Const EM_LINEINDEX = &HBB
Code:
'displays the caret's coordinates of a richtextbox ' 'programmed by Alexander Triantafyllou (BSc. I.T.) alextriantf@yahoo.gr 'feel free to use it wherever you like ' 'Greetings from Athens - Greece ' 'IN A FORM 'insert a richtextbox called editbox and 'a caption called lblcoord Private Sub displaycoords() lebsel = editbox.SelStart lline = SendMessage(editbox.hWnd, EM_EXLINEFROMCHAR, ByVal CLng(0), ByVal CLng(editbox.SelStart)) llindex = SendMessage(editbox.hWnd, EM_LINEINDEX, ByVal lline, ByVal CLng(0)) lblcoord.Caption = CStr(lebsel - llindex + 1) + ":" + CStr(lline + 1) End Sub
Home
|
Forums
|
Submit
|
Books
|
Mailing List
|
Advertising
|
About
|
Contact
© 2024 A1VBCode. All rights reserved.
Legal disclaimer & terms of use
Privacy statement