1. UI
2. Calling through code
1 usingSystem;2 usingSystem.Collections.Generic;3 usingSystem.ComponentModel;4 usingSystem.Data;5 usingSystem.Drawing;6 usingSystem.Linq;7 usingSystem.Text;8 usingSystem.Threading.Tasks;9 usingSystem.Windows.Forms;Ten One namespaceWindowsFormsApplication1 A { - Public Partial classForm1:form - { the PublicForm1 () - { - InitializeComponent (); - } + - Private voidButton1_Click (Objectsender, EventArgs e) + { A //The Sender object type, which is loaded with Button1, is the key point. atButton BTN =(Button) sender; -TextBox1.Text =btn. Text; - } - - Private voidButton2_Click (Objectsender, EventArgs e) - { in //this sender contains Button2. - Button1_Click (sender, E); to } + - Private voidForm1_Load (Objectsender, EventArgs e) the { * $ }Panax Notoginseng } -}
3. Through the Properties panel neighbor: Event invocation
4.
Effect 1
Effect 2
Effect 3
C#winform the Code of the button button called the other