with this code I can create at runtime textbox components:
List<TextBox> customTextBox = new List<TextBox>();
foreach (string ValutaCustomScelta in Properties.Settings.Default.ValuteCustom)
{
TextBox textbox = new TextBox();
textbox.Location = new System.Drawing.Point(295, 117 + customTextBox.Count * 26); textbox.BackColor = Color.Black;
textbox.ForeColor = Color.Lime;
textbox.Parent = tabPage2;
textbox.Name = "textbox_" + SelectValute;
textbox.Size = new System.Drawing.Size(80, 21);
customTextBox.Add(textbox);
tabPage2.Controls.Add(textbox);
tabPage2.Controls.SetChildIndex(textbox, 0);
}
This code is placed in form 2, but I need the that textboxes are created to be in form1. I dont know which instruction is needed to add it in this code.
Thanks in advance
EDIT:
You need to keep a reference to
Form1inForm2. For example:Then you can use this in
Form2:You’ll need to create
Form2like this (fromForm1):