Click here to Skip to main content
15,886,963 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionLANGID to wstring Pin
zon_cpp11-Oct-11 23:42
zon_cpp11-Oct-11 23:42 
AnswerRe: LANGID to wstring Pin
Randor 11-Oct-11 23:54
professional Randor 11-Oct-11 23:54 
QuestionMFC - how to get an edit box text from another dialog?? (Constructor) Pin
symeramon11-Oct-11 20:58
symeramon11-Oct-11 20:58 
AnswerRe: DDX_Text Pin
App_11-Oct-11 21:42
App_11-Oct-11 21:42 
AnswerRe: MFC - how to get an edit box text from another dialog?? (Constructor) Pin
enhzflep11-Oct-11 21:43
enhzflep11-Oct-11 21:43 
GeneralRe: MFC - how to get an edit box text from another dialog?? (Constructor) Pin
Richard MacCutchan11-Oct-11 21:46
mveRichard MacCutchan11-Oct-11 21:46 
GeneralRe: MFC - how to get an edit box text from another dialog?? (Constructor) Pin
enhzflep11-Oct-11 23:31
enhzflep11-Oct-11 23:31 
AnswerRe: MFC - how to get an edit box text from another dialog?? (Constructor) Pin
Madhu Nair11-Oct-11 21:44
Madhu Nair11-Oct-11 21:44 
Keep a public CString member variable in Child dialog class, set the member variable before calling the DoModal() or Create function of child dialog. Call SetWindowText of edit control in InitDialog.

for. eg

If CMainDlg is your Main dialog class and CChildDialog be the child.
in header of CChildDialog you declare a public member variable to hold the string
C++
class CChildDialog : public CDialog
{
 public :
 CString m_strText;
}

and in your button click function of CMainDlg do this

C++
void CMainDlg::OnClick_Button()
{
  
  CChildDialog oChildDlg; 
  oChildDlg.m_strText = strText; // This should be the edit box value
  oChildDlg.DoModal();
}


Set the variable value in CChildDialog's OnInitDialog as

C++
CChildDialog::OnInitDialog()
{
  SetDlgItemText(ID_OF_YOUR_EDIT, m_strText);
}


You can also set the text by modifying your constructor of CChildDialog, such as
C++
CChildDialog::CChildDialog(CString strText)

GeneralRe: MFC - how to get an edit box text from another dialog?? (Constructor) Pin
symeramon11-Oct-11 22:14
symeramon11-Oct-11 22:14 
AnswerRe: MFC - how to get an edit box text from another dialog?? (Constructor) Pin
Richard MacCutchan11-Oct-11 21:45
mveRichard MacCutchan11-Oct-11 21:45 
GeneralRe: MFC - how to get an edit box text from another dialog?? (Constructor) Pin
symeramon11-Oct-11 22:21
symeramon11-Oct-11 22:21 
AnswerRe: MFC - how to get an edit box text from another dialog?? (Constructor) Pin
David Crow12-Oct-11 3:10
David Crow12-Oct-11 3:10 
GeneralRe: MFC - how to get an edit box text from another dialog?? (Constructor) Pin
symeramon12-Oct-11 3:43
symeramon12-Oct-11 3:43 
GeneralRe: MFC - how to get an edit box text from another dialog?? (Constructor) Pin
symeramon12-Oct-11 3:48
symeramon12-Oct-11 3:48 
GeneralRe: MFC - how to get an edit box text from another dialog?? (Constructor) Pin
Chandrasekharan P12-Oct-11 21:38
Chandrasekharan P12-Oct-11 21:38 
QuestionLANGID Pin
zon_cpp11-Oct-11 20:52
zon_cpp11-Oct-11 20:52 
AnswerRe: LANGID Pin
Richard MacCutchan11-Oct-11 21:42
mveRichard MacCutchan11-Oct-11 21:42 
AnswerRe: LANGID Pin
Richard MacCutchan11-Oct-11 23:18
mveRichard MacCutchan11-Oct-11 23:18 
AnswerRe: LANGID Pin
Randor 11-Oct-11 23:34
professional Randor 11-Oct-11 23:34 
QuestionCListCtrl Pin
john563211-Oct-11 20:43
john563211-Oct-11 20:43 
AnswerRe: CListCtrl Pin
zon_cpp11-Oct-11 21:03
zon_cpp11-Oct-11 21:03 
GeneralRe: CListCtrl Pin
john563211-Oct-11 22:00
john563211-Oct-11 22:00 
GeneralRe: CListCtrl Pin
Randor 11-Oct-11 23:10
professional Randor 11-Oct-11 23:10 
AnswerRe: CListCtrl Pin
Rolf Kristensen12-Oct-11 2:24
Rolf Kristensen12-Oct-11 2:24 
Questionhow to write/read in text file with mfc project?? Pin
antonio34311-Oct-11 7:29
antonio34311-Oct-11 7:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.