I have a two-dimensional array of random integers that are in an array of textboxes. I found the maximum and brought it to Label1. Everything works. But I still need to colour the textbox in which this maximum is located. I had versions, but unsuccessful. Please help, who knows where the error is?
C#:
int max = Convert.ToInt32(t[0, 0].Text);
for (i = 0; i < x; i++)
{
for (j = 0; j < y; j++)
{
if (Convert.ToInt32(t[i, j].Text) > max)
{
max = Convert.ToInt32(t[i, j].Text);
t[i, j].BackColor = Color.Red;
label1.Text = "" + max;
}
}
}
Last edited by a moderator: