Reputation: 21
Why get an error A first chance exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll
code:
if (wynik[rozmiarMacierzy] == 0)
{
for (int t = 0; t < rozmiarMacierzy; t++)
{
appendText(wynikiTextBox, wynik[t].ToString() + "\n");
}
}
and
private void appendText(RichTextBox textBox, string text)
{
textBox.Invoke(new MethodInvoker(delegate { textBox.Text += text; }));
}
Upvotes: 0
Views: 2441
Reputation: 63065
add wynik.Length >rozmiarMacierzy
condition like below
if (wynik.Length >rozmiarMacierzy && wynik[rozmiarMacierzy] == 0)
{
for (int t = 0; t < rozmiarMacierzy; t++)
{
if( wynik[t]!=null)
appendText(wynikiTextBox, wynik[t].ToString() + "\n");
}
}
Upvotes: 0