| CodeGuru Home | VC++ / MFC / C++ | .NET / C# | Visual Basic | Newsletters | VB Forums | Developer.com |
|
|||||||
| Managed C++ and C++/CLI Discuss Managed C++ and .NET-specific questions related to C++. |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
How can I position the caret in a text box to be at the bottom of the text box?
I have a text box in my windows form that I use as a status window. It displays what the program is doing at all times. My problem is that when I do a DoEvents(), the text box always scrolls back up to the very top making the latest program events hidden. How can I make sure my text box always shows the very bottom instead of the top when I call DoEvents?
Last edited by chinniwhites; July 25th, 2005 at 04:01 PM. |
|
#2
|
|||
|
|||
|
Re: How can I position the caret in a text box to also be at the bottom of the text b
I was looking on the web and found some stuff on textbox->selectionstart and textbox->selectionlength. So I tried the following code to no avail:
txtStatus->Focus(); txtStatus->SelectionStart = txtStatus->Bottom; txtStatus->SelectionLength = 0; txtStatus->ScrollToCaret(); cmdStop->Focus(); |
|
#3
|
|||
|
|||
|
Re: How can I position the caret in a text box to also be at the bottom of the text b
Figured it out and figured I would let those curious about in on it as well. Pretty simple and here it is:
txtStatus->SelectionStart = txtStatus->Text->Length; txtStatus->SelectionLength = 0; txtStatus->ScrollToCaret(); Thats it. Short and sweet! |
![]() |
| Bookmarks |
|
||||||
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|