hello there, i have a problem, it might be trivial but i cannot for the life of me understandw what is causing it.
so i have a numeric updown and based on the value, it loops and creates as many txtboxes as the value in hte numupdown. and then i have a loop that reads the text in these but its not working as intended.
for (int i = 1; i <= numericUpDown1.Value;i++)
{
string textname = "txtName"+i;
TextBox txtTemp = new TextBox();
txtTemp.Location = new Point(x,y);
txtTemp.Name = textname;
txtTemp.Width = 100;
grpCol.Controls.Add(txtTemp);
}
this is the txtbox creating code.
and this is the read loop:
for(int i =1; i <= numericUpDown1.Value; )
{
if (childControl.Name.EndsWith(i.ToString()))
{
if(childControl.GetType().ToString().Equals("System.Windows.Forms.TextBox"))
{
txt2.Text += ((TextBox)childControl).Text;
}
if (childControl.HasChildren)
{
IterateThroughChildren(childControl);
}
}
i++;
}
and so when i run the code and creat 4 txtboxes like this
txta1 txtb1
|_______| |________|
txta2 txtb2
|_______| |________|
with the values being:
1 2
3 4
i get the output 3124, when i want 1234.
sorry if im being incoherent, but couldnt explain it better.
if you read this far... thank you:P