• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4346
  • Last Modified:

Get Text From single line CEdit control

I have two CEdit controls on a dialog, I have assigned CEdit variables to each.  They are used to enter a user id and password so they are only single line edit controls.  I just want to get the text out of each.  I knoow this is not difficult but I have never used CEdit's before and am in a bit of a rush.

THanks PT
  • 2
1 Solution
CEdit m_Edit1; //let's say this is one of the CEdit vars
CString strPass = mEdit1.GetWindowText();
Sorry, that should be:

CString strPass;
There are some options:

1. assign a member variable (through class wizard) of type "CEdit", e.g. m_edit
(nonubik's solution)

   CString strEdit;

2. assign a member variable (through class wizard) of type "CString", e.g. m_strEdit  

   UpdateData(TRUE); // m_strEdit will get the current text
3. without a member variable

   CString strEdit;
   GetDlgItemText(IDC_EDIT, strEdit);

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now