|
-
Mar 30th, 2006, 09:16 PM
#1
Re: Selected character Column and Row position [UNRESOLVED]
 Originally Posted by jmcilhinney
I don't think you understand what I mean. Let me be explicit.
VB Code:
Dim rowIndex As Integer = 0
Dim colIndex As Integer = Me.TextBox1.SelectionStart
For Each line As String In Me.TextBox1.Lines
'Check whether the caret is in the current line.
If colIndex <= line.Length Then
'The caret is not in the current line.
Exit For
Else
rowIndex += 1
'Subtract the length of the current line including the line break.
colIndex -= (line.Length + 2)
End If
Next line
MessageBox.Show(String.Format("Row: {0}, Column: {1}", rowIndex + 1, colIndex + 1))
My god, Jm! No need for API with code like that, much better!
-
Mar 30th, 2006, 09:29 PM
#2
Thread Starter
Fanatic Member
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
|