Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. MFC : Not able to populate db records in list control of MFC SDI application

MFC : Not able to populate db records in list control of MFC SDI application

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++databasecomdesign
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    catchy87
    wrote on last edited by
    #1

    Hi All, I am struggling these days in creating an MFC application which has following problem statement: --> In MFC, Create an UI list control which will populate data from one table using db connectivity. What I have done so far : --> Created a SDI MFC application, --> Able to connect to db, fetch record in "Edit Box" and traverse between records(First,Last,Next,Previous). where I am stuck: --> I am not able to populate these records in List control. I have taken reference from "c++ - How to add items to a List Control in an MFC dialog - Stack Overflow[^]" but it has asked to write code under "OnInitDialog" method which is not present in SDI application. Though I can able to see this method in Dialog based MFC application but not in SDI application. Request you to all to please help me. Thanks, Sanjeev

    J 1 Reply Last reply
    0
    • C catchy87

      Hi All, I am struggling these days in creating an MFC application which has following problem statement: --> In MFC, Create an UI list control which will populate data from one table using db connectivity. What I have done so far : --> Created a SDI MFC application, --> Able to connect to db, fetch record in "Edit Box" and traverse between records(First,Last,Next,Previous). where I am stuck: --> I am not able to populate these records in List control. I have taken reference from "c++ - How to add items to a List Control in an MFC dialog - Stack Overflow[^]" but it has asked to write code under "OnInitDialog" method which is not present in SDI application. Though I can able to see this method in Dialog based MFC application but not in SDI application. Request you to all to please help me. Thanks, Sanjeev

      J Offline
      J Offline
      Jochen Arndt
      wrote on last edited by
      #2

      With not dialog based applications you should derive your view class from CListView Class[^]. That can then be populated with the recordsets using the CListView::GetListCtrl[^] function to get a reference to the list control. The OnInitDialog() corresponding function for views is CView::OnInitialUpdate[^]. See also the example code at the GetListCtrl() link.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups