Set the data volume set to a multi-value control.

Source: Internet
Author: User

Set the data volume set to using system; using system on the multi-value control. collections. generic; using system. componentmodel; using system. data; using system. drawing; using system. text; using system. windows. forms; using northwinddataaccess; namespace comboboxselectedvalue {public partial class selectedvalueform: FORM {public selectedvalueform () {initializecomponent ();} private void onformload (Object sender, eventargs E) {// get the dat A And m_customersdataset = customersdataset. getmers MERs (); // set up the bindings for the combo boxes m_companynamecombo.datasource = metric; metric = "companyName"; metric = "customerid"; m_contactnamecombo.datasource = metric; metric = "contactname "; m_contactnamecombo.valueme Mber = "phone"; // hook up event handlers for selection change events updated + = oncomboselectionchanged;} private void oncomboselectionchanged (Object sender, eventargs ARGs) {If (m_contactnamecombo.selectedvalue = NULL | m_companynamecombo.selectedvalue = NULL) return; m_customeridtextbox.text = Compute (); m_contactphonetextbox.text = compute () ;}} in this example, the combined box controls m_companynamecombo and m_contactnamecombo are set to the MERs table of the dataset type. Displaymember adequacy of the two boxes is set to the corresponding companyName and contactname adequacy (column ), display each number in the MERs table as text in the combination box. Further, the valuemember encoding of the first box control m_companynamecombo is set to customerid encoding, and the second drop-down list is set to phone encoding. In this way, when selectedvalue adequacy is asked each time, the selectedvalue adequacy of the Combination box will give the valuemember adequacy value of the previous value in the combination box.

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.