Results 1 to 3 of 3

Thread: Texteditor

  1. #1
    Registered
    Join Date
    Aug 2007
    Location
    Belgium
    Posts
    17
    Downloads
    0
    Uploads
    0

    Texteditor

    Is there someone ho nows how i can find the row and kolom in a textwindow programd in VB6.
    I'm writing a controlorprogamme for my CNC machine and want to edit the ISO-code and wont to now the location from the cursor.


  2. #2
    Moderator Switcher's Avatar
    Join Date
    Apr 2005
    Location
    mydxf.blogspot.com
    Posts
    3,665
    Downloads
    0
    Uploads
    0
    This is how I do it in VB.net 2005. I know you asked for VB6, maybe it will help?


    Code:
    Private Sub RichTextBox1_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles RichTextBox1.SelectionChanged
            'Get the line number and colom number and show it
            Dim intFirstChar As Integer = Me.RichTextBox1.GetCharIndexFromPosition(New Point(0, 0))
            Dim intFirstLine As Integer = Me.RichTextBox1.GetLineFromCharIndex(intFirstChar)
            Dim intCharCount As Integer = (Me.RichTextBox1.SelectionStart + Me.RichTextBox1.SelectionLength) - intFirstChar
            Dim strFromStart As String = Me.RichTextBox1.Text.Substring(intFirstChar, intCharCount)
            Dim intLine As Integer = strFromStart.Split(vbLf).Length
    
    
            ' This is the Row Number
            Me.lblLine_Counter.Text = (intFirstLine + intLine)
    
            ' This is the Column Number
            Me.Label1.Text = "Column: " & (intCharCount - strFromStart.LastIndexOf(vbLf))
    
          
        End Sub


  3. #3
    Registered
    Join Date
    Aug 2007
    Location
    Belgium
    Posts
    17
    Downloads
    0
    Uploads
    0
    Thanks for the help, it just work fine and now i can edit the G-code and find the foult on the richt line
    Thanks again


Posting Permissions


 


About CNCzone.com

    We are the largest and most active discussion forum from DIY CNC Machines to the Cad/Cam software to run them. The site is 100% free to join and use, so join today!

Follow us on

Facebook Dribbble RSS Feed


Search Engine Friendly URLs by vBSEO ©2011, Crawlability, Inc.