Enabling a tool bar Via MDI Child
I first load the MDI parent and then Load a Child form for the login page. Once the person logs in I can't enable the toolbar on the MDI parent from the child. Can anyone please point me in the right direction.
I first load the MDI parent and then Load a Child form for the login page. Once the person logs in I can't enable the toolbar on the MDI parent from the child. Can anyone please point me in the right direction.
I hope this makes sense.
I will try once more - I have a MDI app, create a MDI child login screen which tells the MDI parent which toolbar to make visible to the user. But my problem is the communication between the MDI child and the MDI parent. I cannot make this work.
What I have done to get by is to create a SDI application instead and starting the application with this code
[STAThread]
static void Main()
{
Login frmLogin = new Login();
frmLogin.Show();
Application.Run();
}
I think I actually might be better off using SDI for my application as I am determining which Main screen to load based on the login security level. This is working fine and I am able to load the correct SDI form based on security level. I was hoping to try to contain all forms inside a MDI container but I couldn't make it work.
Any help you could give on the MDI parent/ child communication would be great
Me.MdiParent.SomeProperty = someValue
Then, in the Property Set procedure of SomeProperty in the parent form, you can run code to enable to correct toolbar.
child
public event EventHandler OnLoggedOn;
// a helper method to fire the event , say a login button clicked
void btnLogin_Clicked(object obj, EventArgs args)
{
if( null != OnLoggedOn)
OnLoggedOn(this, new EventArgs());
}
while in the parent
public parent(){
// constructor in parent
// assuming child is the reference to the child form
child.OnLoggedOn += new EventHandler(LoadToolBar);
}
void LoadToolBar(object sender, EventArgs args)
{
// here's where you load it
}
the example just show you the empty eventargs , you could create a custom event args accordingly and define your own delegate