rmokkenstorm
Freshman
- Joined
- Feb 20, 2006
- Messages
- 31
I have a problem.
On my form (mainform) is use a panal wich should load another form (form1)
now i placed the panal en he should load the form1 when the mainform loads.
but i get this error:
Top-level control cannot be added to a control.
i don't know what to do whit this error.
this is my code
i use visual C# 2005
and offcourse writing in C#
can anyone help me?
On my form (mainform) is use a panal wich should load another form (form1)
now i placed the panal en he should load the form1 when the mainform loads.
but i get this error:
Top-level control cannot be added to a control.
i don't know what to do whit this error.
Code:
public partial class main : Form
{
Form1 from1;
public main()
{
InitializeComponent();
}
internal Form1 From1
{
get
{
if (this.from1 == null)
{
this.from1 = new Form1();
this.panel1.Controls.Add(this.from1);
this.from1.Dock = DockStyle.Fill;
}
return this.from1;
}
}
private void main_Load(System.Object sender, System.EventArgs e)
{
this.FFrom1();
}
internal void FFrom1()
{
this.From1.Visible = true;
}
this is my code
i use visual C# 2005
and offcourse writing in C#
can anyone help me?