Hi,
I was able to get it to work using the code below. What I want to do next is store the information of the buyer and seller in another table. I'm using a Customer table to populate the ComboBox. Next I want select a buyer and seller from the ComboBox and then store those two names in a Transaction table. My question is what is the correct value to store in the Transaction table: the m_CustomerID,m_CustomerName or the value from SetItemData. The way I understand SetItemData is that it is used to set a unique value to each index. Any thoughts on this?
Soutine
CCustomerSet TmpSet;
CCustomerSet* m_pSet = &TmpSet;
CComboBox* pBuyerBox;
CComboBox* pSellerBox;
pBuyerBox = &m_cbBuyer;
pSellerBox = &m_cbSeller;
if(TmpSet.IsOpen())
TmpSet.MoveFirst();
else
TmpSet.Open();
int nBuyerIndex;
int nSellerIndex;
while(!TmpSet.IsEOF())
{
nBuyerIndex = pBuyerBox->AddString(TmpSet.m_CustomerName);
nSellerIndex = pSellerBox->AddString(TmpSet.m_CustomerName);
pBuyerBox->SetItemData(nBuyerIndex,TmpSet.m_CustomerID);
pSellerBox->SetItemData(nSellerIndex,TmpSet.m_CustomerID);
TmpSet.MoveNext();
}