Hallo, ich habe folgendes problem:
dies möchte ich zweidimensional machen. ein einfaches Array funktioniert....aber ich kann es nicht zwei dimensional machen...
wenn ich es so mache, gibt er mir ein fehler aus.
ich hoffe ihr könnt mir weiterhelfen
Code:
for (int i = 0; i < int.Parse(txtanzahlad.Text); i++)
{
for (int j = 1; j <= 5; j++)
{
TextBox txtping = new TextBox();
txtping.Name = "txtping" + i.ToString() + "_" + j.ToString();
txtping.Location = new Point(iX+300+pingx, iY);
txtping.Size = new Size(67, 20);
txtping.Visible = true;
txtping.ReadOnly = true;
panel1.Controls.Add(txtping);
pingx += 80;
}
}
dies möchte ich zweidimensional machen. ein einfaches Array funktioniert....aber ich kann es nicht zwei dimensional machen...
Code:
//in public partial class Form1 : Form
TextBox[][] txtping;
//vor meiner schleife
txtping = new TextBox[int.Parse(txtanzahlad.Text)][5];
//meine angepasste schleife:
for (int i = 0; i < int.Parse(txtanzahlad.Text); i++)
{
for (int j = 1; j <= 5; j++)
{
txtping[i][j] = new TextBox();
txtping[i][j].Name = "txtping" + i.ToString() + "_" + j.ToString();
txtping[i][j].Location = new Point(iX+300+pingx, iY);
txtping[i][j].Size = new Size(67, 20);
txtping[i][j].Visible = true;
txtping[i][j].ReadOnly = true;
panel1.Controls.Add(txtping[i][j]);
pingx += 80;
}
wenn ich es so mache, gibt er mir ein fehler aus.
ich hoffe ihr könnt mir weiterhelfen