0
In a form the user will be able to choose the amount of images he can put, for each image I must create a texbox to put the URL of each image. He will determine this amount through a NumericUpDown
, then I have to read its value and apply it to the function to create the amount of textbox:
I tried so:
private void criaImg(TextBox[] txt, int X, int Y, int qnt)
{
int cont = 0;
while (cont < qnt)
{
txt[cont] = new System.Windows.Forms.TextBox();
txt[cont].Location = new System.Drawing.Point(X, Y + Y);
txt[cont].Name = "img" + cont;
txt[cont].Size = new System.Drawing.Size(100, 20);
txt[cont].TabIndex = 1;
cont++;
}
}
private void qntImg_ValueChanged(object sender, EventArgs e)
{
TextBox[] array = new TextBox[(int)qntImg.Value];
criaImg(array, 20, 30, (int)qntImg.Value);
}
Perhaps it would be simpler to put a button ADD
and when the user clicks there it creates a textbox but it doesn’t work, how do I do it?