0
By playing the items one by one within an array, position 0 with 0 and so on, it works correctly. But the code has a malfunction because ,in the first iteration is normal in the second of the error:
Invalidargument=Value of '1' is not Valid for 'index'. It is certain that position 1, is not index, but I no longer want to select the index from the list.
for (j = 0; j <= notas_operacao; j++) <== quantidade de notas no listbox
{
foreach (var item in listBox_Nfe.Items) <==== corre listBox
{
notas[j] = listBox_Nfe.Items[j].ToString(); <==deveria jogar list item atual em posição de vetor em j
MessageBox.Show(notas[j]); => debug
}
}
Only with narrow stretch it becomes difficult to evaluate.
– Maniero
It is simply this part of my application that is failing, this time when I try to take all the items in a listbox and play in a vector string
– bp002
http://answall.com/help/mcve
– Maniero
If you make a
foreach
of each element oflistBox
, pq not allocate innotas
the variableitem
offoreach
? Actually you don’t even need the external, just theforeach
just, just put a variablej
outside andj++
within theforeach
– Gustavo Cinque
That’s exactly what it was.
– bp002