Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7933709
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T21:24:43+00:00 2026-06-03T21:24:43+00:00

I am (very) new to C#, and I am trying to implement an existing

  • 0

I am (very) new to C#, and I am trying to implement an existing application metamodel in this language. In this metamodel, a “menus” table holds a combination of forms and actions, indicating, for each form, which actions should be available.

I am then able to use this “menus” datasource to build and display a form’s specific MenuStrip at runtime. Each item in the menu (ToolStripMenuItem) holds the corresponding ‘action’ string. Clicking on this item should launch the corresponding command.

So now is the question: how do I link the action string of the ToolStripmenuItem to the corresponding command?

My first idea was to maintain a HashTable containing the action string as a key, and the method to be executed, like this:

a generic CommandHandler method:

delegate void CommandHandler(string[] args);

and, in my main module, a HashTable looking like this

myHashCommandTable.Add 
    (   "issueThePurchaseOrder", 
        new CommandHandler(PurchaseOrder.IssueThePurchaseOrder))

I could then run the corresponding command at runtime:

if myHashCommandTable.ContainsKey(myActionString)
{
    ((CommandHandler)myHashCommandTable[myActionString])
}

But this would force me to maintain this HashTable “by hand”, and it could quickly become a source of trouble for the developpers, and instability for the application! Any other idea?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T21:24:45+00:00Added an answer on June 3, 2026 at 9:24 pm

    I guess you could just store the name of target method in your data source and then use reflection to look it up at run-time. Passing data to the target method would be tricky, but that’s just one more exciting challenge for you to overcome!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am all very new to this and am trying to use extended hex
I am very new to generics and trying to implement it. How can i
I am very new to C++ and I am trying to implement a TriangleDynamic
I'm very new to RoR, and am trying to implement a user login system.
I am very new to OOP styled PHP, and I am trying to implement
I am trying to implement a very basic system from my C# .NET application
Very much new to web development and Jekyll, and trying to implement TapirGo into
I'm very new to the AJAX and Javascript world and I'm trying to implement
I'm very new with functional programming, lisp and lambda calculus. Im trying to implement
Hi I am very new to MVC and I am currently trying to implement

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.