Results 1 to 11 of 11

Thread: Selected character Column and Row position [RESOLVED]

Hybrid View

  1. #1
    PowerPoster jcis's Avatar
    Join Date
    Jan 2003
    Location
    Argentina
    Posts
    4,430

    Re: Selected character Column and Row position [UNRESOLVED]

    Quote Originally Posted by jmcilhinney
    I don't think you understand what I mean. Let me be explicit.
    VB Code:
    1. Dim rowIndex As Integer = 0
    2.         Dim colIndex As Integer = Me.TextBox1.SelectionStart
    3.  
    4.         For Each line As String In Me.TextBox1.Lines
    5.             'Check whether the caret is in the current line.
    6.             If colIndex <= line.Length Then
    7.                 'The caret is not in the current line.
    8.                 Exit For
    9.             Else
    10.                 rowIndex += 1
    11.  
    12.                 'Subtract the length of the current line including the line break.
    13.                 colIndex -= (line.Length + 2)
    14.             End If
    15.         Next line
    16.  
    17.         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!

  2. #2

    Thread Starter
    Fanatic Member Ruku's Avatar
    Join Date
    Jul 2002
    Location
    Canada
    Posts
    655

    Re: Selected character Column and Row position [UNRESOLVED]

    neat, I would have gone for every character... heh, jump by line and compare if <... nice going there !

    thx to everyone on this!
    (And I did need wordwrap...)


    Using VB.NET 2005/.NET 2.0, NetBeans IDE 5, Fujitsu Cobol85,
    Website: http://DreamForgery.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width