I get \"Index was outside the bounds of the array\" on this line, what\'s wrong?
Kort[x, y] = Sort[x] + Valor[y] + \" \";
Below is the
Sort is an array 0..3, and Valor is 0..12. So you cannot use Sort[4] and Valor[13].
Start your array accesses from 0, and not 1
So, change to this:
private void Form1_Load(object sender, EventArgs e)
{
Valor[0] = "2";
Valor[1] = "3";
Valor[2] = "4";
Valor[3] = "5";
Valor[4] = "6";
Valor[5] = "7";
Valor[6] = "8";
Valor[7] = "9";
Valor[8] = "10";
Valor[9] = "Knekt";
Valor[10] = "Dam";
Valor[11] = "Kung";
Valor[12] = "Ess";
Sort[0] = "H";
Sort[1] = "R";
Sort[2] = "S";
Sort[3] = "K";
}
Also, start any of your loops at 0, instead of 1. And make the conditional be less than the length, not until equal. More like:
for (int i=0; i < theArray.Length; i++)
in C# arrays are zero-based...
look at what Kevek answered you plus:
this:
for (this.x = 1; this.x <= 4; this.x++)
{
for (this.y = 1; this.y <= 13; this.y++)
...
should be:
for (this.x = 0; this.x < 4; this.x++)
{
for (this.y = 0; this.y < 13; this.y++)
...