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

    Filling ListView Control FROM ANOTHER DIALOG

    i have two custom dialogs. One of the dialog contain a ListView control and it is displayed with a button on the other dialog, Before it is shown,I want its listview control to be filled with certain items. My code is like this:


    void CBillPage1::OnButtonGenerate()
    {
    // TODO: Add your control notification handler code here
    // Soem code here......
    // ...............
    // ............... database variable etc
    // table difintiion
    table.Open();

    // Fill dlg with items
    while (!table.IsEOF())
    {
    dlg->m_ListBill.InsertItem(0,table.m_Date); // here is the problem
    table.MoveNext();
    }
    // Report dialog is selected
    dlg->DoModal();
    }

    It does not give compilation error but gives nun time error at the InsertItem() line.
    Please help


  2. #2
    Guest

    Re: Filling ListView Control FROM ANOTHER DIALOG

    Hi
    I think the problem is, that the ListCtrl in not created yet. I would do the following:
    - place the code to fill the ListCtrl in OnInitDialog and give the constructor of your second dialog a pointer to the first dialog (pParent)
    with this pointer you can access the data of the table,etc...


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