c# mdiparent accessing the controls from child form


I have an application in which consists of an mdiparent which will house the links to various modules in the application.  The first thing a user sees is a login form, upon successful login, they are to be presented with a row of buttons on the mdiform for the modules that their account gives them access to.

how can I add the buttons to the mdiparent, or make them 'visible' in this way?


Who is Participating?
Mike TomlinsonConnect With a Mentor Middle School Assistant TeacherCommented:

Yes.  First you need to change the Modifiers() property of the those buttons to Public.

Next you have to CAST the MdiParent() property to the correct type.  For example, if the MdiParent was of type "frmMdiParent", then you'd do:

    // ...(from the MdiChild)...
    frmMdiParent main = (frmMdiParent)this.MdiParent;
    main.btnTask1.Visible = true;
    main.btnTask2.Visible = true;
Mike TomlinsonMiddle School Assistant TeacherCommented:
Either add a ToolStrip control to your MdiParent, or add a Panel to the MdiParent and set its Dock() property to Top (then add Buttons to the Panel).
Ess KayEntrapenuerCommented:
you can try this:

1 make them in a child form, dock them on the bottom,
use On_load, child.show. child.parent = me


2 get something like infragistics, and use the status bar to add buttons to it


3. drag a panel or groupbox to the paent, and add buttons inside it

hope that helps
cycledudeAuthor Commented:

I have got a panel with buttons inside it on the parent mdi form, but how do I access them from the child form...

when the user clicks login on the child form I am accessing the database to see if the credentials are correct.  If they are correct, I need to check the users access rights within the system and display the corresponding controls...

I thought I may have been able to do something like:

if (useraccess == 1)


do I need to make the buttons 'public'?
cycledudeAuthor Commented:
perfecto, thanks!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.