Share via


CWnd::BindDefaultProperty

voidBindDefaultProperty(DISPIDdwDispID**,VARTYPEvtProp,LPCTSTRszFieldName,CWnd *pDSCWnd);**

Parameters

dwDispID

Specifies the DISPID of a property on a data-bound control that is to be bound to a data-source control.

vtProp

Specifies the type of the property to be bound — for example, VT_BSTR, VT_VARIANT, and so on.

szFieldName

Specifies the name of the column, in the cursor provided by the data-source control, to which the property will be bound.

pDSCWnd

Points to the window that hosts the data-source control to which the property will be bound. Call GetDlgItem with the resource ID of the DCS’s host window to retrieve this pointer.

Remarks

Binds the calling object’s default simple bound property (such as an edit control), as marked in the type library, to the underlying cursor that is defined by the DataSource, UserName, Password, and SQL properties of the data-source control. The CWnd object on which you call this function must be a data-bound control. BindDefaultProperty might be used in the following context:

BOOL CMyDlg::OnInitDialog()
{
   ...
   CWnd* pDSC = GetDlgItem(IDC_REMOTEDATACONTROL);
   CWnd* pList = GetDlgItem(IDC_DBLISTBOX);
   pList->BindDefaultProperty(0x2,
      VT_BSTR, _T("CourseID"), pDSC);
   CWnd* pEdit = GetDlgItem(IDC_MASKEDBOX);
   pEdit->BindDefaultProperty(0x16,
      VT_BSTR, _T("InstuctorID"), pDSC);
   ...
   return TRUE;
}

CWnd OverviewClass MembersHierarchy Chart

See Also   CWnd::GetDSCCursor, CWnd::BindProperty