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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. MFC: Continuosly looping problem?

MFC: Continuosly looping problem?

Scheduled Pinned Locked Moved C / C++ / MFC
c++helptutorialquestion
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.
  • A Offline
    A Offline
    Ashman
    wrote on last edited by
    #1

    Hi, I have the following code: CString itemcount2; SetDlgItemText(IDC_BUGGER, _T(itemcount)); GetDlgItemText(IDC_BUGGER,itemcount2); for (int i=1;i The idea is to get the String for itemcount out of an ini file. Then to loop the function to the value of itemcount. Lets say for example that itemcount = 4, in the list control it will add all the items etc, but it will continue adding rows until -43. I have worked out that if I didnt have the `int nItemCount = atoi(itemcount2) - 1; itemcount2.Format(_T("%d"),nItemCount);` in it, that it wouldn't create rows to -43, however it wouldn't show all the data I needed to add to the list control. Is there anyway to stop it from going below 0? I dont know if anyone can understand this, I barely do. itemcount is read from an ini file using CIniEx. Thanks in advance Ashman

    D 1 Reply Last reply
    0
    • A Ashman

      Hi, I have the following code: CString itemcount2; SetDlgItemText(IDC_BUGGER, _T(itemcount)); GetDlgItemText(IDC_BUGGER,itemcount2); for (int i=1;i The idea is to get the String for itemcount out of an ini file. Then to loop the function to the value of itemcount. Lets say for example that itemcount = 4, in the list control it will add all the items etc, but it will continue adding rows until -43. I have worked out that if I didnt have the `int nItemCount = atoi(itemcount2) - 1; itemcount2.Format(_T("%d"),nItemCount);` in it, that it wouldn't create rows to -43, however it wouldn't show all the data I needed to add to the list control. Is there anyway to stop it from going below 0? I dont know if anyone can understand this, I barely do. itemcount is read from an ini file using CIniEx. Thanks in advance Ashman

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      Ashman wrote: SetDlgItemText(IDC_BUGGER, _T(itemcount)); If itemcount is an int, this statement makes no sense. If it is not an int, then the following statement is in error:

      for (int i=1;i<itemcount;i++)

      Ashman wrote: const int IDX = m_sold.InsertItem(i, _T("")); This statement looks odd as i is never 0. In other words, the first item added has an index of 1.


      A rich person is not the one who has the most, but the one that needs the least.

      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