CRecordView::CRecordView

CRecordView( LPCSTR lpszTemplateName );

CRecordView( UINT nIDTemplate );

Parameters

lpszTemplateName

Contains a null-terminated string that is the name of a dialog template resource.

nIDTemplate

Contains the ID number of a dialog template resource.

Remarks

When you create an object of a type derived from CRecordView, call either form of the constructor to initialize the view object and identify the dialog resource on which the view is based. You can either identify the resource by name (pass a string as the argument to the constructor) or by its ID (pass an unsigned integer as the argument). Using a resource ID is recommended.

Note   Your derived class must supply its own constructor. In the constructor of your derived class, call the constructor CRecordView::CRecordView with the resource name or ID as an argument, as shown in the example below.

CRecordView::OnInitialUpdate calls UpdateData, which calls DoDataExchange. This initial call to DoDataExchange connects CRecordView controls (indirectly) to CRecordset field data members created by ClassWizard. These data members cannot be used until after you call the base class CFormView::OnInitialUpdate member function.

Note   If you use ClassWizard, the wizard defines an enum value CRecordView::IDD and specifies it in the member initialization list for the constructor where you see IDD_MYFORM in the example. The example shows how you can specify the dialog template resource ID if you write the code yourself without the wizard.

Example

CMyRecordView::CMyRecordView()
   : CRecordView( IDD_MYFORM )
{
   //{{AFX_DATA_INIT( CMyRecordView )
      // NOTE: the ClassWizard will add member initialization here
   //}}AFX_DATA_INIT
   // Other construction code, such as data initialization
}

CRecordView OverviewClass MembersHierarchy Chart

See Also   CRecordset::DoFieldExchange, CView::OnInitialUpdate, CWnd::UpdateData