Disable Menuitem on Parent form a child

G

Guest

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
 
K

Ken Tucker [MVP]

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

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

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
 

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

Top