Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / August 2006

Tip: Looking for answers? Try searching our database.

Name property in MainMenu/MenuItem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Trevor Benedict R - 03 Aug 2006 20:14 GMT
What I am trying to do is to store some sort of a Reference to the Menu in
the database and then based on permission I can either Enable or disable
them. I am specifically looking for the Name/ID/Tag property, but
unforturnately could not find one for the Mainmenu or Menuitem.

Any ideas.

TIA

Trevor Benedict
simida - 04 Aug 2006 03:09 GMT
Maybe you can extend MenuItem and add your custom property to subclass
that inherits MenuItem, such as ,Tag.

Now , you can add your subclass to Mainmenu.MenuItems container. Hope
it works.

Sincerely,
simida

Trevor Benedict R 写道:

> What I am trying to do is to store some sort of a Reference to the Menu in
> the database and then based on permission I can either Enable or disable
[quoted text clipped - 6 lines]
>
> Trevor Benedict
Trevor Benedict R - 05 Aug 2006 19:09 GMT
Thanks. I have already done that, but do not know how to tell the inherited
control from MainMenu to use my MenuItem instead of the one from
windows.forms.menuitem.

Regards,

Trevor Benedict

Maybe you can extend MenuItem and add your custom property to subclass
that inherits MenuItem, such as ,Tag.

Now , you can add your subclass to Mainmenu.MenuItems container. Hope
it works.

Sincerely,
simida

Trevor Benedict R ??:

> What I am trying to do is to store some sort of a Reference to the Menu in
> the database and then based on permission I can either Enable or disable
[quoted text clipped - 6 lines]
>
> Trevor Benedict
Mini-Tools Timm - 07 Aug 2006 14:55 GMT
> Thanks. I have already done that, but do not know how to tell the inherited
> control from MainMenu to use my MenuItem instead of the one from
> windows.forms.menuitem.

If you've defined your custom menu item as follows:

    public class MyMenuItem : MenuItem { ... }

Then in your inherited control, you can do this:

    void ProcessMenuItem( MenuItem item )
    {
        MyMenuItem myItem = item as MyMenuItem;
        if (myItem != null)
        {
            // process item
        }
    }

Signature

Timm Martin
Mini-Tools
.NET Components and Windows Software
http://www.mini-tools.com

Trevor Benedict R - 08 Aug 2006 04:29 GMT
Thanks Timm,
But what I am looking at it to add some Custom Properties to the MenuItem
Class, by Inheriting it. I then need a way to use this Custom Menu Item
Class to be used by the MainMenu Control while being used in the Design
Mode.

What I have done is to Inherit the MenuItem and I have changed the Designer
Generated Code to Change all references to System.Windows.Forms.MenuItem to
MyProject.MyMenuItem, we'll the downside is that I will leave behind a very
poor design for other developers who might take over this project.

I was wondering if I could somehow Inherit the MainMenu Class and then tell
it to use myMenuItem. Hope I was clear enough.

I've also tried a different approach by using IExtenderProvider, I'm still
working on it.

Regards,

Trevor Benedict R

>> Thanks. I have already done that, but do not know how to tell the
>> inherited
[quoted text clipped - 15 lines]
> }
> }

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.