MFC: Continuosly looping problem?
-
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
-
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
Ashman wrote: SetDlgItemText(IDC_BUGGER, _T(itemcount)); If
itemcount
is anint
, 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.