By setting the AcceptButton attribute of the form, you can set the "accept" button of the form. If this design is used, every time you press Enter, it is equivalent to clicking this button and entering

Source: Internet
Author: User

By setting the AcceptButton attribute of the form, you can set the "accept" button of the form. If this design is used, every time you press Enter, it is equivalent to clicking this button and entering

1 using System; 2 using System. collections. generic; 3 using System. componentModel; 4 using System. data; 5 using System. drawing; 6 using System. text; 7 using System. windows. forms; 8 9 namespace Test0210 {11 public partial class Form1: Form12 {13 public Form1 () 14 {15 InitializeComponent (); 16} 17 18 private void Form1_Load (object sender, eventArgs e) 19 {20 this. acceptButton = button1; 21} 22 23 private void button#click (object sender, EventArgs e) 24 {25 MessageBox. show ("triggered accept button"); 26} 27} 28}

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.