how to display text in a combo box edit control
-
I have a dropdown combo box that needs to be able to accept new entries not listed in the combo box via the edit control. If I create the member variable as a value instead of control, I'm able to save the selection or text input, but how do I display it in the edit control when I reopen the window. I tried the following: private: CString test_value; test_value = m_test; //Saves the selection //m_test = test_value; //tried this first GetDlgItem(IDC_TEST)->SetWindowText(m_test); //this didn't work either UpdateData(FALSE); Please help! Thanks.
-
I have a dropdown combo box that needs to be able to accept new entries not listed in the combo box via the edit control. If I create the member variable as a value instead of control, I'm able to save the selection or text input, but how do I display it in the edit control when I reopen the window. I tried the following: private: CString test_value; test_value = m_test; //Saves the selection //m_test = test_value; //tried this first GetDlgItem(IDC_TEST)->SetWindowText(m_test); //this didn't work either UpdateData(FALSE); Please help! Thanks.
elephantstar wrote:
GetDlgItem(IDC_TEST)->SetWindowText(m_test); //this didn't work either UpdateData(FALSE);
does SetWindowText still not work if you get rid of the UpdateData call ? Cleek | Image Toolkits | Thumbnail maker
-
elephantstar wrote:
GetDlgItem(IDC_TEST)->SetWindowText(m_test); //this didn't work either UpdateData(FALSE);
does SetWindowText still not work if you get rid of the UpdateData call ? Cleek | Image Toolkits | Thumbnail maker
Yes.
-
I have a dropdown combo box that needs to be able to accept new entries not listed in the combo box via the edit control. If I create the member variable as a value instead of control, I'm able to save the selection or text input, but how do I display it in the edit control when I reopen the window. I tried the following: private: CString test_value; test_value = m_test; //Saves the selection //m_test = test_value; //tried this first GetDlgItem(IDC_TEST)->SetWindowText(m_test); //this didn't work either UpdateData(FALSE); Please help! Thanks.
Hi, I don't have more knowlegde about VC++, but try following if it can satisfy your requirement.
//Adds a string in ComboBox
CComboBox *combo = new CComboBox();
combo->m_hWnd = GetDlgItem(IDC_TEST)->m_hWnd;
combo->AddString("AS");
combo->AddString("ZX"); //Adds a string in ComboBox at Last Position
//if 'Sort' option is not Selected.//Following shows the text in ComboBox (must not be in the list of ComboBox)
m_combo = "ZX"; //where 'm_combo' member variable of 'IDC_TEST' ComboBox
// datatype of 'm_combo' is 'CString'
UpdateData(FALSE);Try it. Best Regards, Aniket -- modified at 9:07 Friday 19th May, 2006
-
Hi, I don't have more knowlegde about VC++, but try following if it can satisfy your requirement.
//Adds a string in ComboBox
CComboBox *combo = new CComboBox();
combo->m_hWnd = GetDlgItem(IDC_TEST)->m_hWnd;
combo->AddString("AS");
combo->AddString("ZX"); //Adds a string in ComboBox at Last Position
//if 'Sort' option is not Selected.//Following shows the text in ComboBox (must not be in the list of ComboBox)
m_combo = "ZX"; //where 'm_combo' member variable of 'IDC_TEST' ComboBox
// datatype of 'm_combo' is 'CString'
UpdateData(FALSE);Try it. Best Regards, Aniket -- modified at 9:07 Friday 19th May, 2006
Thanks. That worked.