CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 1999
    Posts
    30

    CFormView-ComboBox

    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

  2. #2
    Join Date
    Apr 1999
    Posts
    306

    Re: CFormView-ComboBox

    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


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured