Debug Assertion & Combo Box?
-
Hi, I have two Dialog boxes, Dialog1 and Dialog2. I need to populate a Combo Box in Dialog2 from Dialog1. When I use the following lines in Dialog1 it compiles without error. CDialog2 ob; ob.m_cComboBox.ResetContent(); However when I run it (and when it reaches the 2nd line above)I get a Debug Assertion Failure in File: afxwin2.inl at line 741 which is this line. { ASSERT(::IsWindow(m_hWnd)); ::SendMessage(m_hWnd, CB_RESETCONTENT, 0, 0); } The Combo Box properties are, Type: Dropdown, Owner draw: Variable Thanks in advance for any help, Aoife
-
Hi, I have two Dialog boxes, Dialog1 and Dialog2. I need to populate a Combo Box in Dialog2 from Dialog1. When I use the following lines in Dialog1 it compiles without error. CDialog2 ob; ob.m_cComboBox.ResetContent(); However when I run it (and when it reaches the 2nd line above)I get a Debug Assertion Failure in File: afxwin2.inl at line 741 which is this line. { ASSERT(::IsWindow(m_hWnd)); ::SendMessage(m_hWnd, CB_RESETCONTENT, 0, 0); } The Combo Box properties are, Type: Dropdown, Owner draw: Variable Thanks in advance for any help, Aoife
chk whether both dialog boxes r created. looks like one dialog is not created and the other is trying to fill the combo box of that uncreated dialog
-
Hi, I have two Dialog boxes, Dialog1 and Dialog2. I need to populate a Combo Box in Dialog2 from Dialog1. When I use the following lines in Dialog1 it compiles without error. CDialog2 ob; ob.m_cComboBox.ResetContent(); However when I run it (and when it reaches the 2nd line above)I get a Debug Assertion Failure in File: afxwin2.inl at line 741 which is this line. { ASSERT(::IsWindow(m_hWnd)); ::SendMessage(m_hWnd, CB_RESETCONTENT, 0, 0); } The Combo Box properties are, Type: Dropdown, Owner draw: Variable Thanks in advance for any help, Aoife
Aoife wrote: CDialog2 ob; ob.m_cComboBox.ResetContent(); This will naturally cause problems. The MFC object has been created. But the window it wraps has not been created yet [in this case, it's the dialog window] Do this instead. Use DoModal to bring up the dialog and put the combo box reset line in it's OnInitDialog function. Regards Nish
The posting stats are now in PDF:- http://www.busterboy.org/codeproject/ Feel free to make your comments. Updated - May 04th, Saturday
-
Aoife wrote: CDialog2 ob; ob.m_cComboBox.ResetContent(); This will naturally cause problems. The MFC object has been created. But the window it wraps has not been created yet [in this case, it's the dialog window] Do this instead. Use DoModal to bring up the dialog and put the combo box reset line in it's OnInitDialog function. Regards Nish
The posting stats are now in PDF:- http://www.busterboy.org/codeproject/ Feel free to make your comments. Updated - May 04th, Saturday
Thanks but that isn't going to be much good to me because later in Dialog1 I need to .AddString() to the ComboBox. I guess what I'll have to do is write the items that need to be put into the ComboBox to a file in Dialog1 and then read them from the file when Dialog2 is opened and put them into the ComboBox.:~ Thanks for your help anyway. Aoife
-
Thanks but that isn't going to be much good to me because later in Dialog1 I need to .AddString() to the ComboBox. I guess what I'll have to do is write the items that need to be put into the ComboBox to a file in Dialog1 and then read them from the file when Dialog2 is opened and put them into the ComboBox.:~ Thanks for your help anyway. Aoife