Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

c# mdiparent accessing the controls from child form

Posted on 2013-01-22
5
Medium Priority
?
2,105 Views
Last Modified: 2013-01-22
Hi

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?

CHeers

CD
0
Comment
Question by:cycledude
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 38805909
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).
0
 
LVL 15

Expert Comment

by:Ess Kay
ID: 38805920
you can try this:


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

or

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


or

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



hope that helps
0
 

Author Comment

by:cycledude
ID: 38805965
Hi

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)
{
 mdiparent.btnTask1.show;
 mdiparent.btnTask2.show;


}

do I need to make the buttons 'public'?
0
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 2000 total points
ID: 38806024
Ah...gotcha.

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;
0
 

Author Closing Comment

by:cycledude
ID: 38806057
perfecto, thanks!
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question