The event on clicking on the button does not work (It exists, all the name is the same) What to do?

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace WindowsFormsApp1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { } private void textBox1_TextChanged(object sender, EventArgs e) { } private void button1_click(object sender, EventArgs e) { MessageBox.Show("Привет"); } } } 
  • five
    In the form editor, select the button, and look at the eventov tab in the properties window for what hangs on button1_click - Alexander Muksimov
  • In an auto-generated event handler, the word Click would be capitalized (and in new versions of the Studio both Button and TextBox also big). So you obviously manually changed something somewhere. - Alexander Petrov
  • Она существует, все название совпадают - the code is better than a thousand words, show the code in which the button is created and the handler is bound to the event. - default locale

1 answer 1

Bind the handler to the event in the code "manually", at the same time and learn how to do it, add to the constructor:

 public Form1() { InitializeComponent(); button1.Click += button1_click; // Эту строчку }