|
-
Feb 26th, 2000, 12:20 AM
#1
Thread Starter
Member
Could someone post code for tracking rows and columns in a multiline textbox.
-
Feb 26th, 2000, 12:53 AM
#2
Fanatic Member
To get Line count use this:
Code:
Option Explicit
Private Declare Function SendMessageLong Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Const EM_GETLINECOUNT = &HBA
Private Sub Text1_Change()
Dim lineCount As Long
On Local Error Resume Next
lineCount = SendMessageLong(Text1.hwnd, EM_GETLINECOUNT, 0&, 0&)
Label1 = Format$(lineCount, "##,###")
End Sub
And to get Row Number try to search for this topic on this forum (I asked the same question some time ago but I didn't copy Row Number thing)
HTH
Edited by QWERTY on 02-26-2000 at 12:59 PM
-
Feb 26th, 2000, 01:01 AM
#3
Thread Starter
Member
Your code will help, but I need to know where the position of the cursor in the textbox. I can track the position on the cursor by using Keypressed event, but it does trigger when I press the arrow keys. Also if the user moves the cursor with mouse, how do I find the new position of the cusor?
-
Feb 26th, 2000, 02:22 AM
#4
Addicted Member
I long time ago I had achived this using my own functions, which for char position, would counnt the charactors behind the selstart position using a loop, and stop when it gets to chr(10) and chr(13).
Then for the line count I counted the chr(10) before the current selstart
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|