Click here to Skip to main content
15,880,469 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Save strings and integer in text file Pin
lolici25-Mar-17 11:27
lolici25-Mar-17 11:27 
SuggestionRe: Save strings and integer in text file Pin
Premnath Mali14-Apr-17 1:40
professionalPremnath Mali14-Apr-17 1:40 
QuestionCMFCToolBarComboBoxButton dont work on some machines Pin
vojtee24-Mar-17 3:21
vojtee24-Mar-17 3:21 
SuggestionRe: CMFCToolBarComboBoxButton dont work on some machines Pin
Richard MacCutchan24-Mar-17 3:40
mveRichard MacCutchan24-Mar-17 3:40 
GeneralRe: CMFCToolBarComboBoxButton dont work on some machines Pin
vojtee24-Mar-17 3:46
vojtee24-Mar-17 3:46 
GeneralRe: CMFCToolBarComboBoxButton dont work on some machines Pin
Richard MacCutchan24-Mar-17 4:02
mveRichard MacCutchan24-Mar-17 4:02 
AnswerRe: CMFCToolBarComboBoxButton dont work on some machines Pin
_Flaviu9-Apr-17 21:53
_Flaviu9-Apr-17 21:53 
QuestionSave the content from List Control in text file vc++ Pin
lolici22-Mar-17 4:16
lolici22-Mar-17 4:16 
Hello everyone,
I have created an editable list control (report style) with numbers. How could I save all content of list in a text file, each edited "number" below the other. I tried something like this:

void CDataDialog::OnOK()
{
	CWnd* pwndCtrl = GetFocus();
	// get the control ID which is 
	// presently having the focus
	int ctrl_ID = pwndCtrl->GetDlgCtrlID();
	CString str;
	ofstream outFile;
	outFile.open("sample.txt");
	switch (ctrl_ID)
	{   //if the control is the EditBox 
	case IDC_EDIT1:
		//get the text from the EditBox
		GetDlgItemText(IDC_EDIT1, str);
		for (int i = 1; i <= m_nCon; i++)
		{
			outFile << str <<endl;
			outFile << m_nCon << endl;
		}
		outFile.close();
			//set the value in the listContorl with the
		//specified Item & SubItem values

		
		SetCell(::GetDlgItem(m_hWnd, IDC_LIST1),
			str, nItem, nSubItem);

		::SendDlgItemMessage(m_hWnd, IDC_EDIT1,
			WM_KILLFOCUS, 0, 0);
		::ShowWindow(::GetDlgItem(m_hWnd, IDC_EDIT1),
			SW_HIDE);
		break;
		
	default:
		break;
	}
}


but by this way I can save only the last edited item in text file. Thank you in advance!!
SuggestionRe: Save the content from List Control in text file vc++ Pin
David Crow22-Mar-17 4:48
David Crow22-Mar-17 4:48 
GeneralRe: Save the content from List Control in text file vc++ Pin
lolici22-Mar-17 5:23
lolici22-Mar-17 5:23 
GeneralRe: Save the content from List Control in text file vc++ Pin
David Crow22-Mar-17 5:26
David Crow22-Mar-17 5:26 
GeneralRe: Save the content from List Control in text file vc++ Pin
lolici22-Mar-17 5:35
lolici22-Mar-17 5:35 
GeneralRe: Save the content from List Control in text file vc++ Pin
David Crow22-Mar-17 5:37
David Crow22-Mar-17 5:37 
GeneralRe: Save the content from List Control in text file vc++ Pin
Victor Nijegorodov22-Mar-17 9:58
Victor Nijegorodov22-Mar-17 9:58 
GeneralRe: Save the content from List Control in text file vc++ Pin
lolici23-Mar-17 2:36
lolici23-Mar-17 2:36 
GeneralRe: Save the content from List Control in text file vc++ Pin
Victor Nijegorodov23-Mar-17 7:20
Victor Nijegorodov23-Mar-17 7:20 
GeneralRe: Save the content from List Control in text file vc++ Pin
lolici23-Mar-17 8:14
lolici23-Mar-17 8:14 
GeneralRe: Save the content from List Control in text file vc++ Pin
Victor Nijegorodov23-Mar-17 12:29
Victor Nijegorodov23-Mar-17 12:29 
QuestionA complex macro definition Pin
samzcs20-Mar-17 10:01
samzcs20-Mar-17 10:01 
AnswerRe: A complex macro definition Pin
Jochen Arndt20-Mar-17 22:37
professionalJochen Arndt20-Mar-17 22:37 
GeneralRe: A complex macro definition Pin
samzcs21-Mar-17 2:22
samzcs21-Mar-17 2:22 
GeneralRe: A complex macro definition Pin
Jochen Arndt21-Mar-17 2:32
professionalJochen Arndt21-Mar-17 2:32 
GeneralRe: A complex macro definition Pin
samzcs21-Mar-17 2:36
samzcs21-Mar-17 2:36 
Questiondev c Pin
Alvi ZaDa20-Mar-17 7:18
Alvi ZaDa20-Mar-17 7:18 
RantRe: dev c Pin
Richard Deeming20-Mar-17 8:47
mveRichard Deeming20-Mar-17 8:47 

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.