Partilhar via


CComboBox::SetTopIndex

Ensures that a particular item is visible in the list-box portion of the combo box.

int SetTopIndex(
   int nIndex 
);

Parameters

  • nIndex
    Specifies the zero-based index of the list-box item.

Return Value

Zero if successful, or CB_ERR if an error occurs.

Remarks

The system scrolls the list box until either the item specified by nIndex appears at the top of the list box or the maximum scroll range has been reached.

Example

// Set the first visible item in the combo box to be the middle item
m_pComboBox->SetTopIndex(m_pComboBox->GetCount() / 2);

Requirements

Header: afxwin.h

See Also

Reference

CComboBox Class

Hierarchy Chart

CComboBox::GetTopIndex

CB_SETTOPINDEX

Other Resources

CComboBox Members