Click to See Complete Forum and Search --> : Two Questions
BestCoder
Oct 8th, 2001, 03:11 PM
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
filburt1
Oct 8th, 2001, 04:24 PM
1. Not sure but probably an API call
2. Haven't tested this (I don't have VB6 (VB5 instead) so I can't :)):
Const LineNumber As Long = 5 ' get the 6th line
Msgbox Split(Text1.Text, vbCrLf)(LineNumber)
chrisjk
Oct 8th, 2001, 04:27 PM
Info that may be useful http://www.mvps.org/vbnet/index.html?code/textapi/txcurrentline.htm
chrisjk
Oct 8th, 2001, 04:29 PM
Originally posted by filburt1
2. Haven't tested this (I don't have VB6 (VB5 instead) so I can't :)):
Const LineNumber As Long = 5 ' get the 6th line
Msgbox Split(Text1.Text, vbCrLf)(LineNumber)
err...how can I put this...no. :)
Kaverin
Oct 8th, 2001, 09:10 PM
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.php?s=&threadid=97916
The relevant part is at the very bottom in my last post to the thread.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.