473,320 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

TextBox question

In a multi-line text box, how can make sure that the most current line is
always displayed? Currently, I have to manually move the scroll bar to the
end of the box. Is there a way to automate this?

TIA

Brad
Nov 20 '05 #1
5 996
Hi Brad,

Place this in the textbox's enter event:
SendKeys.Send("^{END}") // control end

HTH,

Bernie Yaeger

"Brad Markisohn" <db*********@indesign-llc.com> wrote in message
news:uJ**************@TK2MSFTNGP09.phx.gbl...
In a multi-line text box, how can make sure that the most current line is
always displayed? Currently, I have to manually move the scroll bar to the end of the box. Is there a way to automate this?

TIA

Brad

Nov 20 '05 #2
Bernie,

This doesn't seem to work. The behavior is the same with and/or without.
I've tried some of the obvious stuff like setting the SelectionStart
property = text.length without success. The textbox is populated by an
event containing a single text message. The event is fired repetitively
until the process stops or the textbox fills up. I'd like the user to see
the most current message as it's added and be able to see the last message
posted without having to manually scroll.

Thanks

Brad

"Bernie Yaeger" <be*****@cherwellinc.com> wrote in message
news:eN**************@TK2MSFTNGP09.phx.gbl...
Hi Brad,

Place this in the textbox's enter event:
SendKeys.Send("^{END}") // control end

HTH,

Bernie Yaeger

"Brad Markisohn" <db*********@indesign-llc.com> wrote in message
news:uJ**************@TK2MSFTNGP09.phx.gbl...
In a multi-line text box, how can make sure that the most current line is always displayed? Currently, I have to manually move the scroll bar to

the
end of the box. Is there a way to automate this?

TIA

Brad


Nov 20 '05 #3
* "Brad Markisohn" <db*********@indesign-llc.com> scripsit:
In a multi-line text box, how can make sure that the most current line is
always displayed? Currently, I have to manually move the scroll bar to the
end of the box. Is there a way to automate this?


Call the control's 'Focus' method, then its 'Select' method, set the
selection after the last character and call its 'ScrollToCaret' method.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #4
Herfried,

That worked! Interestingly, this works the same with or without a call to
the control's focus method. Is this call necessary?

Thanks for your help.

Brad
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...
* "Brad Markisohn" <db*********@indesign-llc.com> scripsit:
In a multi-line text box, how can make sure that the most current line is always displayed? Currently, I have to manually move the scroll bar to the end of the box. Is there a way to automate this?


Call the control's 'Focus' method, then its 'Select' method, set the
selection after the last character and call its 'ScrollToCaret' method.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>

Nov 20 '05 #5
* "Brad Markisohn" <db*********@indesign-llc.com> scripsit:
That worked! Interestingly, this works the same with or without a call to
the control's focus method. Is this call necessary?


If it works, it's not necessary (make sure it works if the control
doesn't have the focus). I remember that it only worked with a
RichTextBox control if it had the focus.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Hazzard | last post by:
I just realized that the code I inherited is using all asp.net server controls (ie. webform controls) and when I try to update textboxes on the client side, I lose the new value of the textbox when...
3
by: Henry | last post by:
Hi. I've also posted this at another discussion board and here is the original question. ------------------------- "I have this problem and I don't know what I can do. First of all, I have a...
13
by: WALDO | last post by:
I have a .Net TextBox (TextBoxBase, really) in which I am appending about 20 lines of text per second. I use the AppendText() method to accomplish this. This is a great substitute for taking the...
1
by: rn5a | last post by:
I want to create a custom control that encapsulates a Button & a TextBox. When the Button is clicked, the user is asked a question using JavaScript confirm (which shows 2 buttons - 'OK' &...
10
by: garyusenet | last post by:
I have a multiline textbox. The size of the text box should be 75 characters wide, and 5 lines in height like this: - <---75 characters--> <---75 characters--> <---75 characters--> <---75...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.