Send a suggestion!

We're building a brand new version of the site, and we'd love to hear your ideas

Members

Technology Zones

IBM Learning Center

Articles

Hosted By

MaximumASP

Info

[1607] Counting lines in a multi-line textbox

Last post 07-07-2008 4:47 PM by Lego_master. 12 replies.
Page 1 of 1 (13 items)
Sort Posts: Previous Next
  • 01-01-1999 12:00 AM

    [1607] Counting lines in a multi-line textbox

    This thread is for discussions of Counting lines in a multi-line textbox.

    • Post Points: 0
  • Advertisement

    • Red Gate Software

    Advertisement

    Want to boost your .NET application performance?

    Some developers always seem to write efficient and lightening-fast code. What is their secret? It’s ANTS Profiler. “We improved the performance of the application up to 10 times” Dan Ports, Intrigma.

    Try it for yourself now.

  • 11-14-2003 1:06 AM In reply to

    about multi-line textbox

    If I wanted to display each line itself, intead of the numbers, how would I get msgbox, to display the content.
    • Post Points: 0
  • 03-07-2004 11:25 AM In reply to

    I think I misunderstood you, but if you want to display the content of a multiline textbox, use this code:
    Code:
    MsgBox Text1.Text, , Me.Caption

    Change "Text1" to the name of your textbox
    • Post Points: 0
  • 03-07-2004 11:25 AM In reply to

    I think I misunderstood you, but if you want to display the content of a multiline textbox, use this code:
    Code:
    MsgBox Text1.Text, , Me.Caption

    Change "Text1" to the name of your textbox
    • Post Points: 0
  • 11-24-2005 6:27 AM In reply to

    • vsnlth
    • Not Ranked
    • Joined on 11-24-2005
    • New Member
    • Points 35
    Hi

    If I wanted to display each line in a multiline textbox, intead of the numbers, how would I get msgbox, to display the content
    • Post Points: 0
  • 11-24-2005 6:28 AM In reply to

    • vsnlth
    • Not Ranked
    • Joined on 11-24-2005
    • New Member
    • Points 35
    Hi

    If I wanted to display each line in a multiline textbox, intead of the numbers, how would I get msgbox, to display the content
    • Post Points: 0
  • 11-24-2005 6:28 AM In reply to

    • vsnlth
    • Not Ranked
    • Joined on 11-24-2005
    • New Member
    • Points 35
    Hi

    If I wanted to display each line in a multiline textbox, intead of the numbers, how would I get msgbox, to display the content
    • Post Points: 0
  • 11-24-2005 6:29 AM In reply to

    • vsnlth
    • Not Ranked
    • Joined on 11-24-2005
    • New Member
    • Points 35
    Quote:
    [1]Posted by MathiasRav on 7 Mar 2004 11:25 AM[/1]
    I think I misunderstood you, but if you want to display the content of a multiline textbox, use this code:
    Code:
    MsgBox Text1.Text, , Me.Caption

    Change "Text1" to the name of your textbox
    • Post Points: 0
  • 11-24-2005 6:29 AM In reply to

    • vsnlth
    • Not Ranked
    • Joined on 11-24-2005
    • New Member
    • Points 35
    Quote:
    [1]Posted by MathiasRav on 7 Mar 2004 11:25 AM[/1]
    I think I misunderstood you, but if you want to display the content of a multiline textbox, use this code:
    Code:
    MsgBox Text1.Text, , Me.Caption

    Change "Text1" to the name of your textbox
    • Post Points: 0
  • 12-28-2007 4:03 PM In reply to

    • kreylor
    • Not Ranked
    • Joined on 12-28-2007
    • United States
    • New Member
    • Points 0

    vsnlth:
    Hi

    If I wanted to display each line in a multiline textbox, intead of the numbers, how would I get msgbox, to display the content

     

     

    Try this:

    Dim obj As Object

    For Each obj In Me.TextBox1.Lines

    MsgBox(obj.ToString)

    Next

    • Post Points: 0
  • 12-28-2007 4:23 PM In reply to

    • kreylor
    • Not Ranked
    • Joined on 12-28-2007
    • United States
    • New Member
    • Points 0

    Re: [1607] Counting lines in a multi-line textbox

    Just a curious thought.

    Why would you go through that much trouble to count lines in a multi-line textbox when all you have to do is:

    Me.TextBox1.Lines.Length

     

    • Post Points: 0
  • 07-07-2008 4:45 PM In reply to

    Re: [1607] Counting lines in a multi-line textbox

    Ok, I've been trying to get this to work for a few weeks now looking up code and trying all kinds of different things.

    I am using a different methods to count all the Lines in a textbox.  But I need to be able to Input a number and selStart that line. Basically a GoTo Line.... box for my notepad program

     The first method is this:

    Private Sub Form_Load()
    Dim TA_index As Integer
    Dim Found As Integer
    Dim Linenum As Integer
    Dim Pos As Integer
    TA_index = MainForm.FileStrip.SelectedItem.Index - 1
    If MainForm.TextArea(TA_index).Text = "" Then
    lblLines.Caption = "1"
    Exit Sub
    Else
    On Error Resume Next
    Found = -1
    Linenum = 1
    MainForm.TextArea(TA_index).SelStart = Len(MainForm.TextArea(TA_index).Text)
    Pos = MainForm.TextArea(TA_index).SelStart
    Do Until Found = 0
       Found = InStrRev(MainForm.TextArea(TA_index).Text, Chr(10), Pos, 0)
       If Found = 0 Then Exit Do
       Linenum = Linenum + 1
       Pos = Found - 1
    Loop
    lblLines.Caption = Linenum
    End If
    'Make FindForm stay ontop of mainform but all remain useable
    GoToForm.Show vbModeless, MainForm
    End Sub

     basically it makes sure there is text, then selects the end then counts all the carriage returns. i found the base code on another site. i can't remember which. but in any case it seems to work for the counting. but for the life of me i can't make it so that i can't input a number into a textbox and hit a command button and select that line or carriage return.

     So. I tried using your method to count all the lines and I like it, Its less complex then the way above but how could i make either of these methods to select a specific line.

    • Post Points: 0
  • 07-07-2008 4:47 PM In reply to

    Re: [1607] Counting lines in a multi-line textbox

    how would i make a text.selstart for this   using a different textbox and command button

    • Post Points: 0
Page 1 of 1 (13 items)