Now that you have replaced the edit control for the m_CourseID
member of CSectionSet
with a combo box, you need to:
CSectionForm
. You will later use member functions of CComboBox, such as AddString, to fill and read the combo box.
When you complete the next three procedures, the combo box control will have two member variables associated with it: (1) the foreign member variable, m_CourseID
, in the recordset associated with the record view, and (2) the CComboBox member variable in the record view class.
ClassWizard supports having two such member variables bound to the same control.
To remove the old edit control binding
IDC_COURSE
and click Delete Variable. To bind the combo box control to the recordset member
Recall that when you changed the edit control to a combo box, you also changed the tab order so the combo box would directly follow the Course static text control. ClassWizard chooses the member variable name based on the recordset member associated with the static text control that directly precedes it in tab order.
m_pSet->m_CourseID
as the member variable name and exit the Add Member Variable dialog box.To bind the combo box control to the view’s CComboBox member variable
IDC_COURSELIST
, and click Add Variable. The Add Member Variable dialog box appears.
m_ctlCourseList
.Note that this automatically selects CComboBox as the Variable type.