Associate menu item with type

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Andrus

    Associate menu item with type

    In WinForms Menu designer I need to associate type with menu item.
    In properties window for Customer menu item I entered

    =typeof(Custome r)

    but designer creates code

    this.customerTo olStripMenuItem .Tag = "=typeof(Custom er)";

    How to force it to create

    this.customerTo olStripMenuItem .Tag = typeof(Customer );


    Andrus.

  • Nathan

    #2
    Re: Associate menu item with type

    "Andrus" <kobruleht2@hot .eewrote in message
    news:epslAbEtIH A.524@TK2MSFTNG P05.phx.gbl...
    In WinForms Menu designer I need to associate type with menu item.
    In properties window for Customer menu item I entered
    =typeof(Custome r)
    >
    but designer creates code
    >
    this.customerTo olStripMenuItem .Tag = "=typeof(Custom er)";
    >
    How to force it to create
    >
    this.customerTo olStripMenuItem .Tag = typeof(Customer );
    >
    >
    Andrus.
    >
    The "Tag" property stores an instance of an "Object." A System.Type does
    not inherit System.Object, so a type cannot be stored in Tag. You'd have to
    find some sort of work-around such as storing the type's name
    (typeof(Custome r).ToString()), or maybe an integer representing a value in
    an enumeration that contains all the Types that might be assigned to a
    menu's tag. Of course, what you're doing with the Tag on menu_Click will
    determine what is stored in the tag.

    Comment

    Working...