I Create a Windows Forms application with C#.
I have a general Form and a panel on it.
I show subForm into this panel with code:
SubForm objForm= SubForm.InstanceForm(); this.IsMdiContainer = true; objForm.TopLevel = false; pnlSubSystem.Controls.Add(objForm); objForm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; objForm.Dock = DockStyle.Fill; objForm.Show();
now I want to show other form on subForm of this panel, But I dont know how to do it.
I think your problem resolved by this code:
SubForm objForm= SubForm.InstanceForm(); objForm.TopLevel = false; pnlSubSystem.Controls.Add(objForm); objForm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; objForm.Dock = DockStyle.Fill; objForm.Show();
As I understand, you're very close. To add another form into subform
try the same code instead:
pnlSubSystem.Controls.Add(objForm);
use (where objForm2
is the new subForm
)
SubForm objForm2 = new SubForm(); objForm.Controls.Add(objForm2);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With