Cstrings strReturn=_T (" TEST ");
For (int I=m_CList. GetItemCount () - 1; i>=0; I -)
{
If (strReturn==m_CList. GetItemText (I, 1))
{
M_CList. Called DeleteItem (I);
}
}
the cycle like this?
CodePudding user response:
Ok, try it yourself not clear ~CodePudding user response:
Do not recommend, I=CLISTCTRL GET this sentence if there are other threads in the list box operation can make the circulation anomaliesCodePudding user response:
Should pay attention to here, for the expression will only calculate, is not in every loop calculation expression,So, obviously, when you remove elements, the for expression are not heavy, will be wrong
CodePudding user response:
for (A; B; C) D;
//equivalent to the
{
A;
While (1) {
if (! (B)) break;
D;
C;
}
}
CodePudding user response:
Miss zhao mean, is no problem! Int I=m_CList. GetItemCount () - 1; Can run once only, after removing the cycle number still remain the same!CodePudding user response: