本文介绍了“遇到不正当的论点";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这可能是什么问题?工作正常,然后...不正确的参数.
它与删除数组中的记录有关吗?
What could be wrong with this? It was working fine and then...Improper Argument.
Could it have something to do with deleting records from the array?
for(int i = 0; i < FirstName.GetCount(); i++)
{
nItem = m_ListCtrl.InsertItem(0, FirstName[i] + L" " + LastName[i]);
for(int j = 0; j < 8; j++)
{
if(Item[numItems].IsEmpty() == FALSE)
{
nItem = m_ListCtrl.InsertItem(1, L"");
m_ListCtrl.SetItemText(nItem, 1, Item[numItems]);
m_ListCtrl.SetItemText(nItem, 2, Quantity[numItems]);
m_ListCtrl.SetItemText(nItem, 3, Cost[numItems]);
m_ListCtrl.SetItemText(nItem, 4, Price[numItems]);
m_ListCtrl.SetItemText(nItem, 5, Profits[numItems]);
}
numItems++;
}
}
推荐答案
nItem = m_ListCtrl.InsertItem(0, FirstName[i] + L" " + LastName[i]);
可能由于失败(无论出于何种原因)而返回-1,并且以下
might return -1 when not successful (for whatever reason) and the following
m_ListCtrl.SetItemText(nItem, 1, Item[numItems]);
将失败,因为nItem为-1.
will fail because nItem is -1.
s7 = (((_wtof(myData[nPos].m_sPrice7) / _wtof(myData[nPos].m_sQty7)) - _wtof(myData[nPos].m_sCost7)) * _wtof(myData[nPos].m_sQty7));
t7.Format(L"%.2f", s7);
if(s7 > 0)
dlg.Profits.Add(t7);
else
dlg.Profits.Add(L"0");
我添加了else语句来解决我的问题,它又可以正常工作.
I added the else statement to fix my problem, it works fine again.
这篇关于“遇到不正当的论点";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!