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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T01:23:18+00:00 2026-06-05T01:23:18+00:00

If I double click on a new winform button uxHelloButton then the following appears:

  • 0

If I double click on a new winform button uxHelloButton then the following appears:

private void uxHelloButton_Click(object sender, RoutedEventArgs e)

Why is the default private?
If I delete private and leave the following it still works fine:

void uxHelloButton_Click(object sender, RoutedEventArgs e)

Does the addition of this scope avoid potential problems?

  • 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-05T01:23:20+00:00Added an answer on June 5, 2026 at 1:23 am

    The question is: Why would you like to make it accessible?
    In general, it’s better to give each element, the most restrictive permissions needed.
    If you don’t, you are taking the risk that some classes can call this function where they shouldn’t.

    Even from an OOP point of view, this must be private. This function is a callback used by the form to handle the button click. It is not meant to be called explicitly either by you or by any external class.

    If you want to call this method, use the following instead:

    private void uxHelloButton_Click(object sender, RoutedEventArgs e)
    {
        SomethingToDo(...);
    }
    protected void SomethingToDo(...)
    {
        ....
    }
    

    Ps: The default scope in C# for an instance method is private, you did not expand it by removing the private keyword.

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

Sidebar

Related Questions

i create a new form using the code below. private void CNPictureBox2_DoubleClick(object sender, EventArgs
If I accidentally double-click a button on a Winform in the visual studio designer
When I alt(option) double-click a keyword in Xcode 3.2, I get the following popup:
Every time I double click a file it opens it in a new window.
I want to draw some sort graphics on winform using following code : private
Recently, I bought a new macbook and installed weka. When I double click on
I want to disable a button -to prevent double click: On a tablet PC
I would like to open new window when user double-click in specyfic JTable row.
When I double click, it seems that the clearTimeout(timer) doesnt work, and the code
When I double click the XIB file in Xcode, Interface Builder typically launches a

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.