A simple CRecordView demo.
2025-12-20
Written by: xiaobin













void CMFCApplication1View::OnBnClickedButton1()
{
// TODO: Add your control notification handler code here
m_pSet->MoveFirst();
ShowRow();
}
void CMFCApplication1View::OnBnClickedButton3()
{
// TODO: Add your control notification handler code here
if (!m_pSet->IsEOF()) {
m_pSet->MoveNext();
ShowRow();
}
}
void CMFCApplication1View::OnBnClickedButton4()
{
// TODO: Add your control notification handler code here
if ( !m_pSet->IsBOF()) {
m_pSet->MovePrev();
ShowRow();
}
}
void CMFCApplication1View::OnBnClickedButton2()
{
// TODO: Add your control notification handler code here
m_pSet->MoveLast();
ShowRow();
}
void CMFCApplication1View::ShowRow()
{
int nItem;
CString tmp;
tmp.Format(_T("%d"), m_pSet->m_qty);
m_ListCtrl.DeleteAllItems();
nItem = m_ListCtrl.InsertItem(0, CString(m_pSet->m_stor_id));
m_ListCtrl.SetItemText(nItem, 1, CString(m_pSet->m_ord_num));
m_ListCtrl.SetItemText(nItem, 2, m_pSet->m_ord_date.Format("%Y-%m-%d"));
m_ListCtrl.SetItemText(nItem, 3, tmp);
m_ListCtrl.SetItemText(nItem, 4, CString(m_pSet->m_payterms));
m_ListCtrl.SetItemText(nItem, 5, CString(m_pSet->m_title_id));
}