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 8462303
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T14:07:45+00:00 2026-06-10T14:07:45+00:00

I am implementing a WinForms form in a C# project. My form is a

  • 0

I am implementing a WinForms form in a C# project.
My form is a child of a MDI form.
My form contains a user control.
My user control contains some buttons including a validation button and a cancel one.

I want to implement the following logic :

  • When my form is active and the user presses the enter key then I want the validation button clicked event to be fired automatically.
  • When my form is active and the user presses the escape key then I want the cancel button clicked event to be fired automatically.

If my validation and my cancel buttons were not included in a user control then I would probably set the AcceptButton and CancelButton properties of my form.

  • 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-10T14:07:47+00:00Added an answer on June 10, 2026 at 2:07 pm

    Here is the code I have written in the Load event handler of my user control according to a tip given by Arthur in a comment to my first post :

    // Get the container form.
    form = this.FindForm();
    
    // Simulate a click on the validation button
    // when the ENTER key is pressed from the container form.
    form.AcceptButton = this.cmdValider;
    
    // Simulate a click on the cancel button
    // when the ESC key is pressed from the container form.
    form.CancelButton = this.cmdAnnulerEffacer;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm implementing a scatter plot using the MS Chart Control .NET 3.5, WinForms, C#.
My project contains WinForms, WPF, and Windows Service programs running on users' office desktop
I'm working on a WinForms app and I have a user control in it.
I am implementing a Fuzzy Date control in C# for a winforms application. The
I am working on a winforms project. I am implementing an MVP architecture. I
Let's assume I'm implementing a Winforms UI where all commands adhere to the following
My question is regarding implementing MVC pattern in winforms I learned that the controller
I'm trying to implement Authorization and Authentication in my current winforms project. The Authentication
I have a user control and I want the developer who drops the user
I'm working on a large Winforms project for a client that is using business

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.