CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 1999
    Posts
    10

    Need help with Edit Box

    I have a dialog with an Edit box. Now I would like to save what ever I type in the box into a string variable´when I either push a button next to the edit box or when I simple hit enter.

    Can anyone tell me how this is done?
    I'm pretty new to mfc so please try to explain it in detail. Thanks




  2. #2
    Join Date
    Apr 1999
    Posts
    40

    Re: Need help with Edit Box

    It is simple. I always use UpdateData(TRUE) and then whatever member variable you have set up for the edit box (using Class Wizard) now contains whatever is in the edit box. To use it with a button, all you need to use in the function is that line. Such as this-

    void CDialogDlg::OnButton3()
    {
    UpdateData(TRUE);
    CString Password = m_Edit;
    //m_Edit being the member variable for the
    // edit box
    SavePasswordToRegistry(Password);
    }

    Lorn "ljp" Potter
    Trolltech Qtopia Community Liaison
    irc.freenode.net #qtopia, #qt

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured