I want to generate textBox or listBox by pressing a buttom on a selected form. (From the secondary to the Principal). through Codigo, It consists of generating notes and adding them in a TabControl, which contains a TabPage, in this desire to add the controls to be generated.
This is the Principal
This secondary
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace agenda
{
public partial class Nueva_asignatura : Form
{
public Nueva_asignatura()
{
InitializeComponent();
}
private void Nueva_asignatura_Load(object sender, EventArgs e)
{
}
private void button2_Click(object sender, EventArgs e)
{
button1.Text = "Guardar cambios";
}
private void checkBox6_CheckedChanged(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
FmPrincipal Principal = new FmPrincipal();
TabControl hoja = new TabControl();
TabPage pagina = new TabPage();
TextBox NuevaAsignatura = new TextBox();
NuevaAsignatura.Location = new Point(400,150);
pagina.Controls.Add(NuevaAsignatura);
hoja.Controls.Add(pagina);
// NuevaAsignatura.Location = pagina.Controls.Add();
// this.Controls.Add(NuevaAsignatura);
NuevaAsignatura.Text = textBox1.Text + Environment.NewLine
+ textBox3.Text + Environment.NewLine
+ textBox4.Text + Environment.NewLine
+ domainUpDown1.Text + " : " + domainUpDown2.Text + Environment.NewLine
+ domainUpDown3.Text + " : " + domainUpDown4.Text + Environment.NewLine.ToString();
hoja.Location = new Point(300, 200);
// Principal.Controls.Add(hoja);
}
}
}