Hosting Forms + events question

  • Thread starter Thread starter Darren Guy
  • Start date Start date
D

Darren Guy

Hello

I have a main form that has a tab control. Each tab will host a form

So after creating each child form, I run the following code to attach it to
a tab

frm.Owner = this;
frm.TopLevel = false;
frm.WindowState = FormWindowState.Maximized;
frm.FormBorderStyle = FormBorderStyle.None;
tab.Controls.Add(frm);
frm.Dock = DockStyle.Fill;
frm.Show();

My question is how do I raise an event on the child form so that the main
form can react to this event. Specifically I want the main form to know if
the child form displayed is editing or browsing data

Thanks in advance


Darren
 
Hi,

I have never seen that approach, inserting a Form inside another Form, not
even sure if possible though. Usually you have one form and each tabpage has
controls but everything is inside the same form.



A possible solution is that the parent form declare a method that the child
forms can call whenever they need to inform a change of status, you would
have to pass a reference to this parent form in the constructors of the
child.


That the best suggestion I can think of right now


cheers,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top