27, C # inside combo box ComboBox properties and Events

Source: Internet
Author: User

The combo box is what we usually call a drop-down list box. Since it's a drop-down list box, you'll add data to the drop-down list box. Data additions are made through the properties:Items . When you click the property, a dialog box pops up and you can add content to it. The following effects are added:

such as adding: Spring, summer, autumn, winter

650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M01/A7/31/wKioL1njFdizf7imAAA27zk4aMs021.png-wh_500x0-wm_ 3-wmp_4-s_1868706008.png "title=" 1.png "alt=" Wkiol1njfdizf7imaaa27zk4ams021.png-wh_50 "/>


To add content to a drop-down list box, add a selected event to the drop-down list box and display the contents of the selected item.

The code is as follows:

void combobox1selectedindexchanged(Objectsender,EventArgse)
        {
            MessageBox.Show(ComboBox1. Text);
        }

Note: When we select an item in the drop-down list, to remove the selected content, you must use the The Text property, not selectedtext. Because, when clicked, the focus disappears immediately, and after it disappears, the content cannot be taken.

Well, the general content of the study is these, and tomorrow, to refuel.


This article is from the "Smile" blog, please be sure to keep this source http://yiyiweixiao.blog.51cto.com/2476874/1972494

27, C # inside combo box ComboBox properties and Events

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.