How to disable all menus ?

M

MG

I have created a full trust secured form and I want to disable all Menu items
on the form. Is it possible if yes how ?

Thanks,
Milind.
 
M

MG

Let me correct it I want to hide all Menus from the form so that end user
will not see any at the top of the form.

Thanks,
Milind.
 
W

Wes Cronkite

I'm having the same problem. This link doesn't really provide any sort of
help. What we're both looking for is a way to configure a created form so
that when it is opened by a user it won't show the Menu Bars with all the
options to customize the form. All I would want on the top of the screen is
submit and close.

A "little search" doesn't really help either, I've been searching for a
couple weeks now for an answer.
 
M

MG

Try this this works for me it is C# and you can put this in onLoad form
event.!!!


ObjectWrapper commandBars =
(ObjectWrapper)thisApplication.ActiveWindow.CommandBars;

BindingFlags MethodFlags = BindingFlags.InvokeMethod |
BindingFlags.DeclaredOnly | BindingFlags.Public |
BindingFlags.Instance;



BindingFlags PropFlags = BindingFlags.GetProperty |
BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.Instance;
object[] args3 = new object[] {"Menu Bar"};

CommandBar commandBarItem = (CommandBar)commandBars.InvokeByName("Item",
PropFlags, args3, null);
commandBarItem.Enabled = false;

object[] args4 = new object[] {10,30003};

CommandBarControl commandBarMenu =
(CommandBarControl)commandBars.InvokeByName(
"FindControl",
MethodFlags,
args4,
null);

commandBarMenu.Enabled = false;
 
S

Scott at RVC

Hi,

dont forget;
<snip url="http://msdn.microsoft.com/library/d...foPathCustomizingInfoPathMenusandToolbars.asp">

When InfoPath is closed, the state of the toolbars is saved. If you do
not re-enable the controls, they will remain disabled in the InfoPath
UI, including in design mode. You can re-enable these controls when
any built-in events occur, such as the OnSubmitRequest event, or
through any custom business logic process that represents an
appropriate condition for the disabled controls to be re-enabled.
Note, however, that you cannot re-enable controls on the _Shutdown
event in managed code forms.

The process of re-enabling controls is straightforward. You simply
repeat the code for disabling the control, but set the Enabled
property to true for each menu, toolbar, or control you previously
disabled.

</snip>
 

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