CodeGuru Forums -
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic Newsletters VB Forums Developer.com


Newest CodeGuru.com Articles:

  • Installing SQL Server 2008
  • Writing UDFs for Firebird Embedded SQL Server
  • [Updated] Shutdown Manager
  • Building Windows Azure Cloud Service Applications with Azure Storage and the Azure SDK

  • Search CodeGuru:
     



    Go Back   CodeGuru Forums > Visual C++ & C++ Programming > Managed C++ and C++/CLI
    FAQ Members List Calendar Search Today's Posts Mark Forums Read

    Managed C++ and C++/CLI Discuss Managed C++ and .NET-specific questions related to C++.

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1    
    Old July 25th, 2005, 03:38 PM
    chinniwhites chinniwhites is offline
    Member
     
    Join Date: Jun 2005
    Posts: 42
    chinniwhites is an unknown quantity at this point (<10)
    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.
    Reply With Quote
      #2    
    Old July 26th, 2005, 10:42 AM
    chinniwhites chinniwhites is offline
    Member
     
    Join Date: Jun 2005
    Posts: 42
    chinniwhites is an unknown quantity at this point (<10)
    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();
    Reply With Quote
      #3    
    Old July 26th, 2005, 05:37 PM
    chinniwhites chinniwhites is offline
    Member
     
    Join Date: Jun 2005
    Posts: 42
    chinniwhites is an unknown quantity at this point (<10)
    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!
    Reply With Quote
    Reply

    Bookmarks
    Go Back   CodeGuru Forums > Visual C++ & C++ Programming > Managed C++ and C++/CLI


    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 06:44 AM.



    Acceptable Use Policy

    internet.comMediabistrojusttechjobs.comGraphics.com

    WebMediaBrands Corporate Info


    Advertise | Newsletters | Feedback | Submit News

    Legal Notices | Licensing | Permissions | Privacy Policy


    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
    Copyright WebMediaBrands Inc. 2002-2009