cannot convert parameter 1 from 'CComboBox' to 'CComboBox'
-
Hi, I have a combobox in my dialog. And I added a control varaible, app_addr_state, for it. Also, I created a function to do something with it. void registration_Dialog::add_50_states_string ( CComboBox cbox ) { .............. } I tried to call it inside the OnInitDialog( ) add_50_states_string ( app_addr_state ); However, I got the following error when I compiled it. > cannot convert parameter 1 from 'CComboBox' to 'CComboBox' I am a bit confused. Does anyone know what's the problem? Thanks, Kevin
-
Hi, I have a combobox in my dialog. And I added a control varaible, app_addr_state, for it. Also, I created a function to do something with it. void registration_Dialog::add_50_states_string ( CComboBox cbox ) { .............. } I tried to call it inside the OnInitDialog( ) add_50_states_string ( app_addr_state ); However, I got the following error when I compiled it. > cannot convert parameter 1 from 'CComboBox' to 'CComboBox' I am a bit confused. Does anyone know what's the problem? Thanks, Kevin
You probably need to pass a reference to the combobox. It sounds like you are trying to pass a 'CComboBox', and this would pass it by value (creating a copy of the CComboBox). Try 'void registration_Dialog::add_50_states_string (CComboBox & cbox)' and see if that works. (You could also pass by pointer, but references are cleaner in this case.) Debugging - The high art and magic of cussing errors into 'features'
-
You probably need to pass a reference to the combobox. It sounds like you are trying to pass a 'CComboBox', and this would pass it by value (creating a copy of the CComboBox). Try 'void registration_Dialog::add_50_states_string (CComboBox & cbox)' and see if that works. (You could also pass by pointer, but references are cleaner in this case.) Debugging - The high art and magic of cussing errors into 'features'
It works after changing it to "pass by reference". This way is cleaner and less overhead. Thanks, Kevin