Export (0) Print
Expand All
MFC
TRY
Expand Minimize

DDX_FieldText 

The DDX_FieldText function manages the transfer of int, short, long, DWORD, CString, float, double, BOOL, or BYTE data between an edit box control and the field data members of a recordset.


void AFXAPI DDX_FieldText(
   CDataExchange* pDX,
   int nIDC,
   BYTE& value,
   CRecordset* pRecordset 
);
void AFXAPI DDX_FieldText(
   CDataExchange* pDX,
   int nIDC,
   int& value,
   CRecordset* pRecordset 
);
void AFXAPI DDX_FieldText(
   CDataExchange* pDX,
   int nIDC,
   UINT& value,
   CRecordset* pRecordset 
);
void AFXAPI DDX_FieldText(
   CDataExchange* pDX,
   int nIDC,
   long& value,
   CRecordset* pRecordset 
);
void AFXAPI DDX_FieldText(
   CDataExchange* pDX,
   int nIDC,
   DWORD& value,
   CRecordset* pRecordset 
);
void AFXAPI DDX_FieldText(
   CDataExchange* pDX,
   int nIDC,
   CString& value,
   CRecordset* pRecordset 
);
void AFXAPI DDX_FieldText(
   CDataExchange* pDX,
   int nIDC,
   float& value,
   CRecordset* pRecordset 
);
void AFXAPI DDX_FieldText(
   CDataExchange* pDX,
   int nIDC,
   double& value,
   CRecordset* pRecordset 
);
void AFXAPI DDX_FieldText(
   CDataExchange* pDX,
   int nIDC,
   short& value,
   CDaoRecordset* pRecordset 
);
void AFXAPI DDX_FieldText(
   CDataExchange* pDX,
   int nIDC,
   BOOL& value,
   CDaoRecordset* pRecordset 
);
void AFXAPI DDX_FieldText(
   CDataExchange* pDX,
   int nIDC,
   BYTE& value,
   CDaoRecordset* pRecordset 
);
void AFXAPI DDX_FieldText(
   CDataExchange* pDX,
   int nIDC,
   long& value,
   CDaoRecordset* pRecordset 
);
void AFXAPI DDX_FieldText(
   CDataExchange* pDX,
   int nIDC,
   DWORD& value,
   CDaoRecordset* pRecordset 
);
void AFXAPI DDX_FieldText(
   CDataExchange* pDX,
   int nIDC,
   CString& value,
   CDaoRecordset* pRecordset 
);
void AFXAPI DDX_FieldText(
   CDataExchange* pDX,
   int nIDC,
   float& value,
   CDaoRecordset* pRecordset 
);
void AFXAPI DDX_FieldText(
   CDataExchange* pDX,
   int nIDC,
   double& value,
   CDaoRecordset* pRecordset 
);
void AFXAPI DDX_FieldText(
   CDataExchange* pDX,
   int nIDC,
   COleDateTime& value,
   CDaoRecordset* pRecordset 
);
void AFXAPI DDX_FieldText(
   CDataExchange* pDX,
   int nIDC,
   COleCurrency& value,
   CDaoRecordset* pRecordset 
);

Parameters

pDX

A pointer to a CDataExchange object. The framework supplies this object to establish the context of the data exchange, including its direction.

nIDC

The ID of a control in the CRecordView or CDaoRecordView object.

value

A reference to a field data member in the associated CRecordset or CDaoRecordset object. The data type of value depends on which of the overloaded versions of DDX_FieldText you use.

pRecordset

A pointer to the CRecordset or CDaoRecordset object with which data is exchanged. This pointer enables DDX_FieldText to detect and set Null values.

For CDaoRecordset objects, DDX_FieldText also manages transferring COleDateTime, and COleCurrency values. An empty edit box control indicates a Null value. On a transfer from the recordset to the control, if the recordset field is Null, the edit box is set to empty. On a transfer from control to recordset, if the control is empty, the recordset field is set to Null.

Use the versions with CRecordset parameters if you are working with the ODBC-based classes. Use the versions with CDaoRecordset parameters if you are working with the DAO-based classes.

For more information about DDX, see Dialog Data Exchange and Validation. For examples and more information about DDX for CRecordView and CDaoRecordView fields, see the article Record Views.

The following DoDataExchange function for a CRecordView contains DDX_FieldText function calls for three data types: IDC_COURSELIST is a combo box; the other two controls are edit boxes. For DAO programming, the m_pSet parameter is a pointer to a CRecordset or CDaoRecordset.

//Example for DDX_FieldText
void CSectionForm::DoDataExchange( CDataExchange* pDX )
{
    CRecordView::DoDataExchange( pDX );
    DDX_FieldCBString( pDX, IDC_COURSELIST, 
                    m_pSet->m_strCourseID, m_pSet);
    DDX_FieldText( pDX, IDC_ROOM, m_pSet->m_nRoomNo, 
                    m_pSet );
    DDX_FieldText( pDX, IDC_TUITION, 
                    m_pSet->m_dwTuition, m_pSet );
}

Community Additions

ADD
Show:
© 2014 Microsoft