Results 1 to 5 of 5

Thread: Two Questions

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2001
    Location
    Canada
    Posts
    202

    Two Questions

    1.) Is it possible to get the visible text in a multiline textbox? In other words a function that returns the text that is visible and not any text that is beyond the end of the textbox? Or similar result?

    2.) Is there anyway to return a string containing the text of a specified line of a text box?

    Thanks

    BestCoder

  2. #2
    1. Not sure but probably an API call
    2. Haven't tested this (I don't have VB6 (VB5 instead) so I can't ):
    VB Code:
    1. Const LineNumber As Long = 5 ' get the 6th line
    2. Msgbox Split(Text1.Text, vbCrLf)(LineNumber)

  3. #3
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923

  4. #4
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    Originally posted by filburt1
    2. Haven't tested this (I don't have VB6 (VB5 instead) so I can't ):
    VB Code:
    1. Const LineNumber As Long = 5 ' get the 6th line
    2. Msgbox Split(Text1.Text, vbCrLf)(LineNumber)
    err...how can I put this...no.

  5. #5
    Fanatic Member Kaverin's Avatar
    Join Date
    Oct 2000
    Posts
    930
    chrisjk, what filburt said does work. Why did you say 'no' there?

    Back to the two questions:
    1) Check out article Q88387 in MSDN. It's about getting the visible lines of text from a textbox as you asked.

    2) You can use what filburt mentioned if you don't want any extra work (but it may slow down on large amounts of text as the system breaks up the text with Split()), or you can use an API method. In an old thread Nucleus started, I added some other props that would be useful for textboxes, and one of them will show the API way of getting a line. This is the thread: http://www.vbforums.com/showthread.p...threadid=97916
    The relevant part is at the very bottom in my last post to the thread.
    I'm baaaack...
    VB5 Professional Edition, VC++ 6
    Using a 1 gHz Thunderbird, 256 mb RAM, 40 gb HD system with Win98se

    I feel special because I finally figured out how to loop midis: Post link
    I'm a fanatic too

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