RE: Set ComboBox Values ?
-
Hello, Sorry for posting this a second time. I'm using MFC dialog based app. In it I have two dialog boxes Dialog1 and Dialog2. There is a Combo Box in Dialog2 that I want to populate with integer values obtained from Dialog1. I know that I must use ResetContent() and InsertString(). But what I don't know is how to use them from Dialog1. The ComboBox has a control variable in Dialog2 but when I call this in Dialog1 I get errors. (I have included the header files). The following explains what I want to do. Dialog1.cpp #include "Dialog2.h" clear all contents from the Combo Box in Dialog2 while (number < 10) { ... if(some condition) { write whatever the 'number' value is to the combo box in Dialog2 } ... number++; } Does anyone know how I can do this or know of any document explaining this. Thanks in advance, Aoife
-
Hello, Sorry for posting this a second time. I'm using MFC dialog based app. In it I have two dialog boxes Dialog1 and Dialog2. There is a Combo Box in Dialog2 that I want to populate with integer values obtained from Dialog1. I know that I must use ResetContent() and InsertString(). But what I don't know is how to use them from Dialog1. The ComboBox has a control variable in Dialog2 but when I call this in Dialog1 I get errors. (I have included the header files). The following explains what I want to do. Dialog1.cpp #include "Dialog2.h" clear all contents from the Combo Box in Dialog2 while (number < 10) { ... if(some condition) { write whatever the 'number' value is to the combo box in Dialog2 } ... number++; } Does anyone know how I can do this or know of any document explaining this. Thanks in advance, Aoife
Could you tell us which Error you got !! Maybe then somebody can help you . Cheers Sonu
-
Could you tell us which Error you got !! Maybe then somebody can help you . Cheers Sonu
In Dialog2 the ComboBox public control variable is m_cCombo. In Dialog1 when I call m_cCombo.ResetContent(); I get told error C2065: 'm_cCombo' : undeclared identifier error C2228: left of '.ResetContent' must have class/struct/union type In Dialog1.cpp I have included Dialog2.cpp
-
In Dialog2 the ComboBox public control variable is m_cCombo. In Dialog1 when I call m_cCombo.ResetContent(); I get told error C2065: 'm_cCombo' : undeclared identifier error C2228: left of '.ResetContent' must have class/struct/union type In Dialog1.cpp I have included Dialog2.cpp
you must create an object of that class to use the combobox. try this: CDialog2 ob; ob.m_cCombo.ResetContent(); Best Regards Sonu
-
you must create an object of that class to use the combobox. try this: CDialog2 ob; ob.m_cCombo.ResetContent(); Best Regards Sonu
Thanks. That has worked in that now I get no errors when I compile. But when It runs I get a debug assertion failure in File afxwin2.inl at this line (741) { ASSERT(::IsWindow(m_hWnd)); ::SendMessage(m_hWnd, CB_RESETCONTENT, 0, 0); } Does this have something to do with the properties of the ComboBox? Thanks for you help. Aoife
-
Thanks. That has worked in that now I get no errors when I compile. But when It runs I get a debug assertion failure in File afxwin2.inl at this line (741) { ASSERT(::IsWindow(m_hWnd)); ::SendMessage(m_hWnd, CB_RESETCONTENT, 0, 0); } Does this have something to do with the properties of the ComboBox? Thanks for you help. Aoife
check the resource id for the control and for the window... Best Regards Sonu