locked
Select All on clicked Edit Control RRS feed

  • Question

  • I created an event handler for when the user clicks on the edit control, but how do you make it select all when you click on it. In Visual C++ 2010 you simply would use TxtBox->SelectAll() Is there a form of this for Visual Studio 2010?
    Monday, July 11, 2011 6:08 PM

All replies

  • CEdit::SetSel(0, -1); ??
    Visual C++ enthusiast, like network programming and driver development. At present is being engaged in the WinCE/Windows Mobile platform embedded development.
    • Proposed as answer by Raman-SGGS Tuesday, July 12, 2011 5:38 AM
    Tuesday, July 12, 2011 12:44 AM
  • Are you trying in Managed C++? If so, you can try with TextBox.Select Method

    IF you are using MFC, you can check with VisalEleven comments.  

     


    Thanks and Regards Selvam http://www15.brinkster.com/selvamselvam/
    Tuesday, July 12, 2011 5:36 AM
  • Is there a way to do this with CString instead of CEdit?
    Tuesday, July 12, 2011 9:27 PM
  • No.  A CString does not have a selected property.
    Tuesday, July 12, 2011 11:51 PM
  • Is there a way to do this with CString instead of CEdit?

    Do you want sub string or select and display the strings in Edit box? As scott Explained, CString doesn't have property for select the string.

     


    Thanks and Regards Selvam http://www15.brinkster.com/selvamselvam/
    Wednesday, July 13, 2011 4:52 AM
  • I want to make it so that when the edit control is clicked, all the text is selected so if you want to enter something else in there, you don't have to backspace, however, I think I may just set it to clear the edit control when it is clicked if i can't make this work.
    Wednesday, July 13, 2011 7:38 AM