Click to See Complete Forum and Search --> : CFormView-ComboBox


Morftje
July 5th, 1999, 04:39 AM
How do I get the data from my Access-Database in my ComboBox? I get the error "Debug Assertion Failure" all the time.

Student Flanders Language Valley
Programmer

ric
July 5th, 1999, 06:25 AM
I suppose that you have a member variable of type CMyDaoRecordSet in your view class named m_Set. Now in the InitialUpdate() do the following:

try
{
if(! m_Set.IsOpen()) m_Set.Open();
}
catch(CDaoException* e)
{
e->Delete();
return 0;
}

CComboBox* pComboBox = (CComboBox*)GetDlgItem(IDC_COMBO);

if(! m_Set.IsBOF())
{
while(! m_Set.IsEOF())
{
pComboBox->AddString(m_Set.m_NameToAdd);
m_Set.MoveNext();
}
}

If this doesnot help send me your code and I will fix it.

Regards,
ric