Armando
Wed May 07 04:22:33 CDT 2008
Ok Simon,
The solution i find to remove a specific MenuItem.
I have a Menu structure like that:
- MainMenu
- MenuItem1 [0] - index
- MenuItem2 [1]
- SubItem1 [3]
- Subitem2 [2]
- SubItem3 [1]
- License [0]
In my MainForm Initialize i have a bool parameter (Licensed? Yes/Not):
if (cAppSettings.Licensed){
//I remove the License SubMenu
MenuItem mItem = mainMenu.MenuItems[1].MenuItems[0];
mainMenu.MenuItems[1].MenuItems.Remove(mItem);
}
Its work.
--
Armando Rocha
Mobile Developer
http://www.ifthensoftware.com
"Simon Hart [MVP]" <srhartone@yahoo.com> escreveu na mensagem
news:4AD5FCD3-5CDD-40A5-A242-B57FF1BC41B9@microsoft.com...
> Great that you got it working. Do you mind telling the group how you fixed
> it, regardless of whether you solved it using the solution I mentioned or
> not
> to benefit others ;)
> --
> Simon Hart
> Visual Developer - Device Application Development MVP
>
http://simonrhart.blogspot.com
>
>
> "Armando Rocha" wrote:
>
>> Hi,
>>
>> I solved the problem.
>>
>> Thanks Simon and Jin for the help.
>>
>>
>> --
>> Armando Rocha
>> Mobile Developer
>>
>>
http://www.ifthensoftware.com
>> "Simon Hart [MVP]" <srhartone@yahoo.com> escreveu na mensagem
>> news:91E68A21-807D-454A-9323-628A46814CC3@microsoft.com...
>> > You can't do that on CF 2.0/3.5 as this is a bug I believe effects both
>> > desktop and device frameworks which was introduced on 2.0 and wasn't
>> > fixed
>> > in
>> > 3.5. You will have to clear the submenu collection using the Clear
>> > method.
>> > See if this bug report on Microsoft Connect clears things up for you:
>> > https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=201317
>> > --
>> > Simon Hart
>> > Visual Developer - Device Application Development MVP
>> >
http://simonrhart.blogspot.com
>> >
>> >
>> > "Armando Rocha" wrote:
>> >
>> >> hi,
>> >> I put code below to remove a specific item but not work.
>> >> any sugestion?
>> >>
>> >> bool status = true;
>> >> if (status){
>> >> mainMenu.MenuItems.Remove(mainMenu.MenuItems[1].MenuItems[0]);
>> >> }
>> >>
>> >>
>> >> --
>> >> Armando Rocha
>> >> Mobile Developer
>> >>
>> >>
http://www.ifthensoftware.com
>> >> "Armando Rocha" <armandorocha@ifthensoftware.com> escreveu na mensagem
>> >> news:0388E14F-8D5E-4BC3-9261-5D0623186E22@microsoft.com...
>> >> > Ok, Thanks for the help.
>> >> >
>> >> > --
>> >> > Armando Rocha
>> >> > Mobile Developer
>> >> >
>> >> >
http://www.ifthensoftware.com
>> >> > "Simon Hart [MVP]" <srhartone@yahoo.com> escreveu na mensagem
>> >> > news:E66CA464-E6AB-44D6-A296-E18F8BA6743F@microsoft.com...
>> >> >> You can't. You have to clear the menu collection then re-add them
>> >> >> when
>> >> >> required.
>> >> >> --
>> >> >> Simon Hart
>> >> >> Visual Developer - Device Application Development MVP
>> >> >>
http://simonrhart.blogspot.com
>> >> >>
>> >> >>
>> >> >> "Armando Rocha" wrote:
>> >> >>
>> >> >>> Hi,
>> >> >>>
>> >> >>> How can i Hide a MenuItem from MainMenu?
>> >> >>>
>> >> >>> like that:
>> >> >>> menu1.visible = false;
>> >> >>>
>> >> >>> but the menu item dont have a propertie called visible.
>> >> >>>
>> >> >>>
>> >> >>>
>> >> >>> --
>> >> >>> Armando Rocha
>> >> >>> Mobile Developer
>> >> >>>
>> >> >>>
http://www.ifthensoftware.com
>> >> >
>> >>
>> >>
>>