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

  • Home
  • SEARCH
  • 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 6360595
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:40:06+00:00 2026-05-24T23:40:06+00:00

Whilst programming Java GUis I made heavy use of the Action class. The instantiated

  • 0

Whilst programming Java GUis I made heavy use of the Action class. The instantiated action class was passed to numerous button or menu item constructors so that you only had to code the logic in one place.

Each time you clicked on a button/icon/menuitem associated with the action the actionPerformed method would fire and execute the code.

This was a great time saver and allowed me to write the logic only once.

Questions:

  1. Is there a similar class in C# or .NET framework?
  2. Have I got this all wrong and there is a different way to have one set of logic called from multiple buttons/icons/menuitems?
  • 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-05-24T23:40:07+00:00Added an answer on May 24, 2026 at 11:40 pm

    .Net uses events heavily and you can do something like this if you have common functionality.

    protected void button_click(object sender, EventArgs e)
    {
       // Common code here
       // You can use sender parameter to distinguish b/w the buttons.
    }
    

    and

    button1.Click += button_click; 
    button2.Click += button_click; 
    button3.Click += button_click; 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Whilst reviewing some Qt C++ code I came across this: class Foo { Q_OBJECT
I am fairly new to Java programming, and would like to know how to
One of the things I've been struggling with, whilst breaking into Objective-C programming, is
Whilst writing a custom webpart for use in Sharepoint 2007 / WSS 3.0 I've
I'm rather interested in real-time programming and whilst I feel I know a decent
Whilst working on a Java application I've come across the -XX:+UseGetTimeOfDay parameter on a
Whilst programming in Objective-C I've occasionally had methods throw an exception that I wasn't
I'm programming on Android, but I guess this is a general Java 101 question...
I have been following a workshop whilst I'm learning C#. One of the class
Whilst analysing some legacy code with FXCop, it occurred to me is it really

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.