0

to have a good user interface, I wanna the child forms Dock in a panel on main form. the below code works for simple show, but I want my child forms be showDialog. so I think it's better I override the child form load and use showDialog instead open as simple show. Is there any better idea, inform me please! :)

DialogResult dr = new DialogResult();
Form2 frm = new Form2();          


//frm.TopLevel = false;
panel1.Controls.Add(frm );

frm.Dock = DockStyle.Fill;
frm.BringToFront();
Iran_Girl
  • 439
  • 2
  • 11
  • 18
  • You can't use ShowDialog() with a "child form". If the child form is a "dialog" then disable everything that shouldn't be accessed before adding it to the Panel and then re-enable everything when it is closed. – Idle_Mind Jul 02 '13 at 15:44
  • it's not MDI child form. it's simple form. because i have user access. I want disable controls that user don't have access on load form event. so if I do your suggest, I must read database several times. – Iran_Girl Jul 02 '13 at 17:38
  • I understand that you're not using an MDI interface. By "child form" I simply mean that you are using the Form like a Control (with TopLevel = False; otherwise you can't add it to the Panel), thus it is a "child" of the main form. Forms that have TopLevel = False can't use ShowDialog(). Therefore, if you want it to behave LIKE a modal dialog, then you have to manually disable everything so that nothing can be accessed. – Idle_Mind Jul 02 '13 at 18:41

0 Answers0