Results 1 to 3 of 3

Thread: How to determine number of visible lines in a textbox?

  1. #1
    ruther
    Guest

    Angry How to determine number of visible lines in a textbox?

    Hi,

    Can anyone tell me how to determine how many lines are visible inside a textbox ?

    thanks a lot
    Ruther

  2. #2
    Junior Member
    Join Date
    Jan 2002
    Location
    Sas van Gent - Holland
    Posts
    23
    I dont know what text will appear in the textbox, but you might count the enter -signs
    Life is too short.
    Live your life.

    And:
    Believe in god, but dont forget to believe in yourself.

  3. #3
    Yash_Kumar
    Guest
    use this for a text box

    Code:
    Public Function NumberOfLines(TextBox As TextBox) As Integer
    Dim sLines() As String
    
    sLines() = Split(TextBox.Text, vbCrLf)
    NumberOfLines = UBound(sLines)
    End Function
    and this for a Rich text Box

    Code:
    Public Function NumberOfLines(TextBox As RichTextBox) As Integer
    Dim sLines() As String
    
    sLines() = Split(TextBox.Text, vbCrLf)
    NumberOfLines = UBound(sLines)
    End Function

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