473,387 Members | 1,379 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Disable Menuitem on Parent form a child

Hi Everyone,
I seem to be having a problem accessing a menuitem on the MDIParent from a
child form. From a login (frmSecurity -child form) screen, I need to hide a
menuitem based on the users role. The problem is that I can't seem to get
access to the menuitem. I can't get it with code like:
MDIParent.mnuAdministrator.Visible = true
MDIParent is the name of the form I gave. This is also the Startup form (in
the project settings) if this makes a difference. From the child form, the
menuitem is not even accessable. I also set the Modifiers property to Public
for the menuitem. And still I can't see it.
So I though I would setup a function in the MDIparent form and call the
function to set it. Here is the call:
MDIParent.SetAdminMenu(iUserRole)
I have no problem with the code in the parent, but the child form can't see
the function either. I set it for Public access. So why can't I even do that?
I'm alittle confused. Did I miss something. Thanks for any help.
Michael Lee
Nov 21 '05 #1
1 2370
Hi,

I dont think naming the form the same as a form's property is a good
idea. This should work from the child form.
DirectCast(Me.MdiParent, MDIParent).mnuAdministrator.Visible = True

Ken

-----------------

"Michael" <Mi*****@discussions.microsoft.com> wrote in message
news:2A**********************************@microsof t.com...
Hi Everyone,
I seem to be having a problem accessing a menuitem on the MDIParent from a
child form. From a login (frmSecurity -child form) screen, I need to hide a
menuitem based on the users role. The problem is that I can't seem to get
access to the menuitem. I can't get it with code like:
MDIParent.mnuAdministrator.Visible = true
MDIParent is the name of the form I gave. This is also the Startup form (in
the project settings) if this makes a difference. From the child form, the
menuitem is not even accessable. I also set the Modifiers property to Public
for the menuitem. And still I can't see it.
So I though I would setup a function in the MDIparent form and call the
function to set it. Here is the call:
MDIParent.SetAdminMenu(iUserRole)
I have no problem with the code in the parent, but the child form can't see
the function either. I set it for Public access. So why can't I even do
that?
I'm alittle confused. Did I miss something. Thanks for any help.
Michael Lee

Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Marcel | last post by:
Hi, the application I am writing has a MainMenu and a DataGrid (UltraGrid). Now I have to edit the text of each cell in this grid. So far so good. All works fine in editmode but if I press a...
6
by: Claus Holm | last post by:
I'm trying to enable a menuitem in the parent form from a mdichild. Rather than making the menuitems public, I'd go for a public method in the parent form to do the change, but when I call the...
5
by: Brian Henry | last post by:
I have a form with a main menu on it (mdi parent form) and i have a child form with a menu and I am mergeing the menus together for the menu called reports.. now when i do this they merge just...
10
by: Charles Law | last post by:
For some reason, when I click the X to close my MDI parent form, the action appears to be re-directed to one of the MDI child forms, and the parent remains open. I am then unable to close the...
0
by: **Developer** | last post by:
A MDI form has a MenuItem "File" that contains other MenuItems. A MdiChild form also contains a "File" MenuItem containing other MenuItems. They are both mergetype MergeItems and mergeindex=0...
3
by: Eddie | last post by:
If FormMain = MDI parent, FormSub = Child parent, I execute FormSub from the menu like this way. FormSub^ sub = gcnew FormSub; sub->MdiParent = this; sub->Show(); This can generate child...
2
by: polocar | last post by:
Hi, I'm writing a program using Visual C# 2005 Professional Edition, and I was trying to assign multiple MainMenu objects (one by one, of course) to the same Form (let's suppose 2 MainMenu...
4
by: Richard Lewis Haggard | last post by:
What is the mechanism by which a child window can notify its parent that it has been clicked on? -- Richard Lewis Haggard www.Haggard-And-Associates.com
3
by: Richard Lewis Haggard | last post by:
Is there an easy way to disable the hotkey sequence Control F4 or otherwise prevent the action from killing off MDI child windows in VS05/WinForms 2? I've already figured out how to get rid of the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.