Microsoft KB Archive/132396

= FIX: Error C2065: 'DDX_FieldCBIndex' : undeclared identifier =

Article ID: 132396

Article Last Modified on 12/9/2003

-

APPLIES TO

 The ClassWizard, when used with:  Microsoft Visual C++ 6.1

 Microsoft Visual C++ 2.0 Professional Edition

 Microsoft Visual C++ 2.1

 Microsoft Visual C++ 6.01 Professional Edition</li></ul> </li></ul>

-

<div class="notice_section">

This article was previously published under Q132396

<div class="symptoms_section">

SYMPTOMS
When you use ClassWizard to map a drop list combobox to a foreign CRecordset object's field through a record view integer member variable, ClassWizard generates a call to DDX_FieldCBIndex in the record view's DoDataExchange member function: void CMyRecordView::DoDataExchange(CDataExchange* pDX) {     ...      //AFX_DATA_MAP } When compiling the program, the compiler gives you the following compiler error:

error C2065: 'DDX_FieldCBIndex' : undeclared identifier

<div class="cause_section">

CAUSE
The DDX_FieldCBIndex function is not implemented by the Microsoft Foundation Classes.

<div class="resolution_section">

RESOLUTION
Do not bind the integer data member of the record view to a drop down combo box. Bind the data member to an edit control.

<div class="status_section">

STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This problem was fixed in Microsoft Visual C++, 32-bit Edition, version 4.0.

<div class="moreinformation_section">

MORE INFORMATION
When implementing CRecordView and CRecordSet classes, ClassWizard completes two data exchanges. Data is exchanged between the record view control and the record view data members and between it and the record set data members, which are linked to the database fields. <pre class="fixed_text">                 RFX                          DDX

Data         Record                       Dynamic

Source < Field   --->   record   <--- Data --->   controls record       Exchange       view          Exchange set For record view data members that have a corresponding database field, the DDX_Fieldxxx set of functions are used to perform DDX. For those members without corresponding database fields, the DDX_xxx set of functions are used. For every DDX_xxx function, there is typically a corresponding DDX_Fieldxxx function.

The corresponding data exchange function for DDX_FieldCBIndex is DDX_CBIndex, which obtains the index position of the item in the listbox portion of the combobox. This information is meaningless outside of the combo box unless it corresponds to a predefined string. If this is the case, then the data member should be bound to an edit control.

<div class="references_section">